Class MultiValuesConverterFactory
- java.lang.Object
-
- io.micronaut.core.convert.converters.MultiValuesConverterFactory
-
public class MultiValuesConverterFactory extends java.lang.ObjectA factory for creation of variousFormattingTypeConverters to and fromConvertibleMultiValuestype. The other types are eitherIterableorMapor POJOObject. The converters only work when anArgumentConversionContextis provided (so the type is an argument), as the name of the parameter needs to be retrieved from there. AlsoFormatannotation is required and needs to have one of the below mentioned formats: "csv", "ssv", "pipes", "multi", "deep-object". The format can be written in any case, e.g. "DEEP_OBJECT", "deep-object".- Since:
- 3.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMultiValuesConverterFactory.AbstractConverterToMultiValues<T>An abstract class to convert to ConvertibleMultiValues.static classMultiValuesConverterFactory.IterableToMultiValuesConverterA converter fromIterabletoConvertibleMultiValues.static classMultiValuesConverterFactory.MapToMultiValuesConverterA converter fromMaptoConvertibleMultiValues.static classMultiValuesConverterFactory.MultiValuesToIterableConverterA converter to convert fromConvertibleMultiValuesto anIterable.static classMultiValuesConverterFactory.MultiValuesToMapConverterA converter to convert fromConvertibleMultiValuesto anMap.static classMultiValuesConverterFactory.MultiValuesToObjectConverterA converter to convert fromConvertibleMultiValuesto a POJOObject.static classMultiValuesConverterFactory.ObjectToMultiValuesConverterA converter from genericObjecttoConvertibleMultiValues.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFORMAT_CSVValues separated with commas ",".static java.lang.StringFORMAT_DEEP_OBJECTValues are put in the representation with property name forMapand POJOObjectin square after the original parameter name.static java.lang.StringFORMAT_MULTIValues are repeated with the same parameter name forIterable, whileMapand POJOObjectwould be expanded with its property names.static java.lang.StringFORMAT_PIPESValues separated with the pipe "|" symbol similarly to CSV being separated with commas.static java.lang.StringFORMAT_SSVValues separated with spaces " " similarly to CSV being separated with commas.
-
Constructor Summary
Constructors Constructor Description MultiValuesConverterFactory()
-
-
-
Field Detail
-
FORMAT_CSV
public static final java.lang.String FORMAT_CSV
Values separated with commas ",". In case of iterables, the values are converted toStringand joined with comma delimiter. In case ofMapor a POJOObjectthe keys and values are alternating and all delimited with commas.
Note that ambiguity may arise when the values contain commas themselves after being converted to String.Type Example value Example representation Iterable &emsp param=["Mike", "Adam", "Kate"] "param=Mike,Adam,Kate" Map param=["name": "Mike", "age": "30"] &emsp "param=name,Mike,age,30" Object param={name: "Mike", age: 30} "param=name,Mike,age,30" - See Also:
- Constant Field Values
-
FORMAT_SSV
public static final java.lang.String FORMAT_SSV
Values separated with spaces " " similarly to CSV being separated with commas.- See Also:
- Constant Field Values
-
FORMAT_PIPES
public static final java.lang.String FORMAT_PIPES
Values separated with the pipe "|" symbol similarly to CSV being separated with commas.- See Also:
- Constant Field Values
-
FORMAT_MULTI
public static final java.lang.String FORMAT_MULTI
Values are repeated with the same parameter name forIterable, whileMapand POJOObjectwould be expanded with its property names.Type Example value Example representation Iterable &emsp param=["Mike", "Adam", "Kate"] "param=Mike¶m=Adam¶m=Kate Map param=["name": "Mike", "age": "30"] &emsp "name=Mike&age=30" Object param={name: "Mike", age: 30} "name=Mike&age=30" - See Also:
- Constant Field Values
-
FORMAT_DEEP_OBJECT
public static final java.lang.String FORMAT_DEEP_OBJECT
Values are put in the representation with property name forMapand POJOObjectin square after the original parameter name.Type Example value Example representation Iterable &emsp param=["Mike", "Adam", "Kate"] "param[0]=Mike¶m[1]=Adam¶m[2]=Kate Map param=["name": "Mike", "age": "30"] &emsp "param[name]=Mike¶m[age]=30" Object param={name: "Mike", age: 30} "param[name]=Mike¶m[age]=30" - See Also:
- Constant Field Values
-
-