- All Implemented Interfaces:
Converter<String,,Object> Decoder<String,,Object> Encoder<Object,,String> JoinableEncoder<Object,,String> JoinablePrimitiveEncoder<String>,ObjectConverter<String>,PrimitiveDecoder<String>,PrimitiveEncoder<String>,SplittableDecoder<String,,Object> SplittablePrimitiveDecoder<String>
- Direct Known Subclasses:
ParameterConverter
An extensible string converter.
This converter is backed by a StringConverter which can convert primitive and common objects, it can be extended to be able to convert other types of objects by injecting specific compound
decoders and encoders.
This converter is an object converter and as such it can convert collection of objects using a customizable separator.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a string composite converter with the default array/list separator (StringConverter.DEFAULT_ARRAY_LIST_SEPARATOR.StringCompositeConverter(String arrayListSeparator) Creates a string composite converter with the specified array/list separator. -
Method Summary
Modifier and TypeMethodDescriptiondecodeBigDecimal(String value) Decodes to big decimal.decodeBigInteger(String value) Decodes to big integer.decodeBoolean(String value) Decodes to boolean.decodeByte(String value) Decodes to byte.decodeCharacter(String value) Decodes to character.<T> Class<T> decodeClass(String value) Decodes to class.decodeCurrency(String value) Decodes to currency.decodeDouble(String value) Decodes to double.decodeFile(String value) Decodes to file.decodeFloat(String value) Decodes to float.decodeInetAddress(String value) Decodes to inet address.decodeInetSocketAddress(String value) Decodes to inet socket address.decodeInteger(String value) Decodes to integer.decodeLocalDate(String value) Decodes to local date.decodeLocalDateTime(String value) Decodes to local datetime.decodeLocale(String value) Decodes to locale.decodeLong(String value) Decodes to long.decodePath(String value) Decodes to path.decodePattern(String value) Decodes to pattern.decodeShort(String value) Decodes to short.decodeString(String value) Decodes to string.<T> T[]decodeToArray(String value, Class<T> type) Decodes the specified value whose type is represented by the specified class to an array of decoded values.<T> T[]decodeToArray(String value, Type type) Decodes the specified value whose type is the specified type to an array of decoded values.<T> List<T> decodeToList(String value, Class<T> type) Decodes the specified value whose type is represented by the specified class to a list of decoded values.<T> List<T> decodeToList(String value, Type type) Decodes the specified value whose type is the specified type to a list of decoded values.<T> Set<T> decodeToSet(String value, Class<T> type) Decodes the specified value whose type is represented by the specified class to a set of decoded values.<T> Set<T> decodeToSet(String value, Type type) Decodes the specified value whose type is the specified type to a set of decoded values.Decodes to URI.Decodes to URL.decodeZonedDateTime(String value) Decodes to zoned datetime.Encodes file.Encodes boolean.Encodes byte.Encodes character.Encodes class.Encodes double.Encodes float.Encodes integer.Encodes long.Encodes short.Encodes string.encode(BigDecimal value) Encodes big decimal.encode(BigInteger value) Encodes big integer.encode(InetAddress value) Encodes inet address.encode(InetSocketAddress value) Encodes inet socket address.Encodes URI.Encodes URL.Encodes path.Encodes local date.encode(LocalDateTime value) Encodes local datetime.encode(ZonedDateTime value) Encodes zoned datetime.Encodes currency.Encodes locale.Encodes pattern.<T> StringencodeArray(T[] value) Encodes the specified array of values to the encoded type.<T> StringencodeArray(T[] value, Class<T> type) Encodes the specified array of values whose type is represented by the specified class to the encoded type.<T> StringencodeArray(T[] value, Type type) Encodes the specified array of values whose type is represented by the specified class to the encoded type.<T> StringencodeList(List<T> value) Encodes the specified list of values to an encoded value.<T> StringencodeList(List<T> value, Class<T> type) Encodes the specified list of values whose type is represented by the specified class to an encoded value.<T> StringencodeList(List<T> value, Type type) Encodes the specified list of values whose type is the specified type to an encoded value.<T> StringEncodes the specified set of values to an encoded value.<T> StringEncodes the specified set of values whose type is represented by the specified class to an encoded value.<T> StringEncodes the specified set of values whose type is the specified type to an encoded value.Returns the array/list separator used to convert lists and arrays.voidsetArrayListSeparator(String arrayListSeparator) Sets the array/list separator used to convert lists and arrays.voidsetDecoders(List<CompoundDecoder<String, ?>> decoders) Sets the compound decoders used to decode objects.voidsetEncoders(List<CompoundEncoder<?, String>> encoders) Sets the compound encoders used to encode objects.Methods inherited from class io.inverno.mod.base.converter.CompositeConverter
decode, decode, encode, encode, encode, setDefaultDecoder, setDefaultEncoder
-
Constructor Details
-
StringCompositeConverter
public StringCompositeConverter()Creates a string composite converter with the default array/list separator (
StringConverter.DEFAULT_ARRAY_LIST_SEPARATOR. -
StringCompositeConverter
Creates a string composite converter with the specified array/list separator.
- Parameters:
arrayListSeparator- an array/list separator
-
-
Method Details
-
getArrayListSeparator
Returns the array/list separator used to convert lists and arrays.
- Returns:
- an array/list separator
-
setArrayListSeparator
Sets the array/list separator used to convert lists and arrays.
- Parameters:
arrayListSeparator- an array/list separator
-
setDecoders
Description copied from class:CompositeConverterSets the compound decoders used to decode objects.
- Overrides:
setDecodersin classCompositeConverter<String>- Parameters:
decoders- a list of compound decoders
-
setEncoders
Description copied from class:CompositeConverterSets the compound encoders used to encode objects.
- Overrides:
setEncodersin classCompositeConverter<String>- Parameters:
encoders- a list of compound encoders
-
decodeToList
Description copied from interface:SplittableDecoderDecodes the specified value whose type is represented by the specified class to a list of decoded values.
- Specified by:
decodeToListin interfaceSplittableDecoder<String,Object> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the value to decodetype- the class of the decoded object- Returns:
- a list of decoded values
-
decodeToList
Description copied from interface:SplittableDecoderDecodes the specified value whose type is the specified type to a list of decoded values.
- Specified by:
decodeToListin interfaceSplittableDecoder<String,Object> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the value to decodetype- the type of the decoded object- Returns:
- a list of decoded values
-
decodeToSet
Description copied from interface:SplittableDecoderDecodes the specified value whose type is represented by the specified class to a set of decoded values.
- Specified by:
decodeToSetin interfaceSplittableDecoder<String,Object> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the value to decodetype- the class of the decoded object- Returns:
- a set of decoded values
-
decodeToSet
Description copied from interface:SplittableDecoderDecodes the specified value whose type is the specified type to a set of decoded values.
- Specified by:
decodeToSetin interfaceSplittableDecoder<String,Object> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the value to decodetype- the type of the decoded object- Returns:
- a set of decoded values
-
decodeToArray
Description copied from interface:SplittableDecoderDecodes the specified value whose type is represented by the specified class to an array of decoded values.
- Specified by:
decodeToArrayin interfaceSplittableDecoder<String,Object> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the value to decodetype- the class of the decoded object- Returns:
- an array of decoded values
-
decodeToArray
Description copied from interface:SplittableDecoderDecodes the specified value whose type is the specified type to an array of decoded values.
- Specified by:
decodeToArrayin interfaceSplittableDecoder<String,Object> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the value to decodetype- the type of the decoded object- Returns:
- an array of decoded values
-
decodeByte
Description copied from interface:PrimitiveDecoderDecodes to byte.
- Specified by:
decodeBytein interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeShort
Description copied from interface:PrimitiveDecoderDecodes to short.
- Specified by:
decodeShortin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeInteger
Description copied from interface:PrimitiveDecoderDecodes to integer.
- Specified by:
decodeIntegerin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeLong
Description copied from interface:PrimitiveDecoderDecodes to long.
- Specified by:
decodeLongin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeFloat
Description copied from interface:PrimitiveDecoderDecodes to float.
- Specified by:
decodeFloatin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeDouble
Description copied from interface:PrimitiveDecoderDecodes to double.
- Specified by:
decodeDoublein interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeCharacter
Description copied from interface:PrimitiveDecoderDecodes to character.
- Specified by:
decodeCharacterin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeBoolean
Description copied from interface:PrimitiveDecoderDecodes to boolean.
- Specified by:
decodeBooleanin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeString
Description copied from interface:PrimitiveDecoderDecodes to string.
- Specified by:
decodeStringin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeBigInteger
Description copied from interface:PrimitiveDecoderDecodes to big integer.
- Specified by:
decodeBigIntegerin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeBigDecimal
Description copied from interface:PrimitiveDecoderDecodes to big decimal.
- Specified by:
decodeBigDecimalin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeLocalDate
Description copied from interface:PrimitiveDecoderDecodes to local date.
- Specified by:
decodeLocalDatein interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeLocalDateTime
Description copied from interface:PrimitiveDecoderDecodes to local datetime.
- Specified by:
decodeLocalDateTimein interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeZonedDateTime
Description copied from interface:PrimitiveDecoderDecodes to zoned datetime.
- Specified by:
decodeZonedDateTimein interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeCurrency
Description copied from interface:PrimitiveDecoderDecodes to currency.
- Specified by:
decodeCurrencyin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeLocale
Description copied from interface:PrimitiveDecoderDecodes to locale.
- Specified by:
decodeLocalein interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeFile
Description copied from interface:PrimitiveDecoderDecodes to file.
- Specified by:
decodeFilein interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodePath
Description copied from interface:PrimitiveDecoderDecodes to path.
- Specified by:
decodePathin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeURI
Description copied from interface:PrimitiveDecoderDecodes to URI.
- Specified by:
decodeURIin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeURL
Description copied from interface:PrimitiveDecoderDecodes to URL.
- Specified by:
decodeURLin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodePattern
Description copied from interface:PrimitiveDecoderDecodes to pattern.
- Specified by:
decodePatternin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeInetAddress
Description copied from interface:PrimitiveDecoderDecodes to inet address.
- Specified by:
decodeInetAddressin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeInetSocketAddress
Description copied from interface:PrimitiveDecoderDecodes to inet socket address.
- Specified by:
decodeInetSocketAddressin interfacePrimitiveDecoder<String>- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
decodeClass
Description copied from interface:PrimitiveDecoderDecodes to class.
- Specified by:
decodeClassin interfacePrimitiveDecoder<String>- Type Parameters:
T- the target class type- Parameters:
value- the encoded value to decode- Returns:
- a decoded value
- Throws:
ConverterException- if there was an error decoding the value
-
encodeList
Description copied from interface:JoinableEncoderEncodes the specified list of values to an encoded value.
- Specified by:
encodeListin interfaceJoinableEncoder<Object,String> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the list of objects to encode- Returns:
- an encoded value
-
encodeList
Description copied from interface:JoinableEncoderEncodes the specified list of values whose type is represented by the specified class to an encoded value.
- Specified by:
encodeListin interfaceJoinableEncoder<Object,String> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the list of objects to encodetype- the class of the decoded object- Returns:
- an encoded value
-
encodeList
Description copied from interface:JoinableEncoderEncodes the specified list of values whose type is the specified type to an encoded value.
- Specified by:
encodeListin interfaceJoinableEncoder<Object,String> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the list of objects to encodetype- the type of the decoded object- Returns:
- an encoded value
-
encodeSet
Description copied from interface:JoinableEncoderEncodes the specified set of values to an encoded value.
- Specified by:
encodeSetin interfaceJoinableEncoder<Object,String> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the set of objects to encode- Returns:
- an encoded value
-
encodeSet
Description copied from interface:JoinableEncoderEncodes the specified set of values whose type is represented by the specified class to an encoded value.
- Specified by:
encodeSetin interfaceJoinableEncoder<Object,String> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the set of objects to encodetype- the class of the decoded object- Returns:
- an encoded value
-
encodeSet
Description copied from interface:JoinableEncoderEncodes the specified set of values whose type is the specified type to an encoded value.
- Specified by:
encodeSetin interfaceJoinableEncoder<Object,String> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the set of objects to encodetype- the type of the decoded object- Returns:
- an encoded value
-
encodeArray
Description copied from interface:JoinableEncoderEncodes the specified array of values to the encoded type.
- Specified by:
encodeArrayin interfaceJoinableEncoder<Object,String> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the array of objects to encode- Returns:
- an encoded value
-
encodeArray
Description copied from interface:JoinableEncoderEncodes the specified array of values whose type is represented by the specified class to the encoded type.
- Specified by:
encodeArrayin interfaceJoinableEncoder<Object,String> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the array of objects to encodetype- the class of the decoded object- Returns:
- an encoded value
-
encodeArray
Description copied from interface:JoinableEncoderEncodes the specified array of values whose type is represented by the specified class to the encoded type.
- Specified by:
encodeArrayin interfaceJoinableEncoder<Object,String> - Type Parameters:
T- the type of the decoded object- Parameters:
value- the array of objects to encodetype- the class of the decoded object- Returns:
- an encoded value
-
encode
Description copied from interface:PrimitiveEncoderEncodes byte.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes short.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes integer.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes long.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes float.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes double.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes character.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes boolean.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes string.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes big integer.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes big decimal.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes local date.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes local datetime.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes zoned datetime.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes currency.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes locale.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes file.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes path.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes URI.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes URL.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes pattern.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes inet address.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes inet socket address.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-
encode
Description copied from interface:PrimitiveEncoderEncodes class.
- Specified by:
encodein interfacePrimitiveEncoder<String>- Parameters:
value- the value to encode- Returns:
- an encoded value
- Throws:
ConverterException- if there was an error encoding the value
-