Class MultiValuesConverterFactory
java.lang.Object
io.micronaut.core.convert.converters.MultiValuesConverterFactory
A factory for creation of various
FormattingTypeConverters to and from ConvertibleMultiValues type.
The other types are either Iterable or Map or POJO Object.
The converters only work when an ArgumentConversionContext is provided (so the type is an argument), as
the name of the parameter needs to be retrieved from there.
Also Format annotation 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
- Author:
- Andriy Dmytruk
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn abstract class to convert to ConvertibleMultiValues.static classA converter fromIterabletoConvertibleMultiValues.static classA converter fromMaptoConvertibleMultiValues.static classA converter to convert fromConvertibleMultiValuesto anIterable.static classA converter to convert fromConvertibleMultiValuesto anMap.static classA converter to convert fromConvertibleMultiValuesto a POJOObject.static classA converter from genericObjecttoConvertibleMultiValues. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValues separated with commas ",".static final Stringstatic final Stringstatic final StringValues separated with the pipe "|" symbol similarly to CSV being separated with commas.static final StringValues separated with spaces " " similarly to CSV being separated with commas. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
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.Examples Type Example value Example representation Iterable param=["Mike", "Adam", "Kate"] "param=Mike,Adam,Kate" Map param=["name": "Mike", "age": "30"] "param=name,Mike,age,30" Object param={name: "Mike", age: 30} "param=name,Mike,age,30" - See Also:
-
FORMAT_SSV
Values separated with spaces " " similarly to CSV being separated with commas.- See Also:
-
FORMAT_PIPES
Values separated with the pipe "|" symbol similarly to CSV being separated with commas.- See Also:
-
FORMAT_MULTI
Values are repeated with the same parameter name forIterable, whileMapand POJOObjectwould be expanded with its property names.Examples Type Example value Example representation Iterable param=["Mike", "Adam", "Kate"] "param=Mike¶m=Adam¶m=Kate Map param=["name": "Mike", "age": "30"] "name=Mike&age=30" Object param={name: "Mike", age: 30} "name=Mike&age=30" - See Also:
-
FORMAT_DEEP_OBJECT
Values are put in the representation with property name forMapand POJOObjectin square after the original parameter name.Examples Type Example value Example representation Iterable param=["Mike", "Adam", "Kate"] "param[0]=Mike¶m[1]=Adam¶m[2]=Kate Map param=["name": "Mike", "age": "30"] "param[name]=Mike¶m[age]=30" Object param={name: "Mike", age: 30} "param[name]=Mike¶m[age]=30" - See Also:
-
-
Constructor Details
-
MultiValuesConverterFactory
public MultiValuesConverterFactory()
-