public interface ConfigMapper
ConfigMapperProvider to help transformation of
complex structures.| Modifier and Type | Method and Description |
|---|---|
<T> T |
map(Config config,
Class<T> type)
Converts the specified
Config node to the target type. |
<T> T |
map(Config config,
GenericType<T> type)
Convert the specified
Config node into the target type specified by GenericType. |
<T> T |
map(String value,
Class<T> type,
String key)
Converts the value to the target type.
|
<T> T |
map(String value,
GenericType<T> type,
String key)
Converts the value to the target generic type.
|
<T> T map(Config config, GenericType<T> type) throws MissingValueException, ConfigMappingException
Config node into the target type specified by GenericType.
You can use GenericType.create(Type) if needed to wrap a parametrized type.T - type of the resultconfig - config node to converttype - type to extract generics types from (to prevent type erasure)MissingValueException - in case a value is expected and not found (either on this config node or on a subnode)ConfigMappingException - in case the config node cannot be converted into the expected type (e.g. value is
"hello" and expected type is List<Integer>)<T> T map(Config config, Class<T> type) throws MissingValueException, ConfigMappingException
Config node to the target type.
The method uses the mapper function instance associated with the
specified type to convert the Config subtree. If there is
none it tries to find one from ConfigMapperProvider.mapper(Class) from configured
mapper providers.
If none is found, mapping will throw a ConfigMappingException.
T - type to which the config node is to be transformedconfig - config node to be transformedtype - type to which the config node is to be transformedT; never returns nullMissingValueException - in case the configuration node does not represent an existing configuration nodeConfigMappingException - in case the mapper fails to map the existing configuration value
to an instance of a given Java type<T> T map(String value, Class<T> type, String key) throws MissingValueException, ConfigMappingException
T - type of the converted valuevalue - String value to converttype - type to convert tokey - configuration key to be used to create appropriate exceptionsMissingValueException - iin case a value is expected and not found (e.g. when trying to convert to a complex object)ConfigMappingException - in case the String cannot be converted to the expected type<T> T map(String value, GenericType<T> type, String key) throws MissingValueException, ConfigMappingException
T - type of the converted valuevalue - String value to converttype - generic type to convert tokey - configuration key to be used to create appropriate exceptionsMissingValueException - iin case a value is expected and not found (e.g. when trying to convert to a complex object)ConfigMappingException - in case the String cannot be converted to the expected typeCopyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.