@FunctionalInterface public interface ConfigMapperProvider
Config
subtree to specific Java types.
The config system automatically loads ConfigMapperProviders using the
Java ServiceLoader mechanism, and by default the config
system automatically registers all ConfigMappers from all such
providers with every Config.Builder. The application can suppress
auto-registration of loaded mappers by invoking
Config.Builder#disableMapperServices().
Each ConfigMapperProvider can specify a
Priority. The default priority is 100.
Config.Builder#addStringMapper(Class, Function),
Config.Builder#addMapper(ConfigMapperProvider),
Config.Builder#disableMapperServices()| Modifier and Type | Field and Description |
|---|---|
static int |
PRIORITY
Default priority of the mapper provider if registered by
Config.Builder automatically. |
| Modifier and Type | Method and Description |
|---|---|
default Map<GenericType<?>,BiFunction<Config,ConfigMapper,?>> |
genericTypeMappers()
Returns a map of mapper functions associated with appropriate target type (
GenericType<?>. |
default <T> Optional<Function<Config,T>> |
mapper(Class<T> type)
A simple mapping function from config node to a typed value based on the expected class.
|
default <T> Optional<BiFunction<Config,ConfigMapper,T>> |
mapper(GenericType<T> type)
Mapper for a specific generic type.
|
Map<Class<?>,Function<Config,?>> |
mappers()
Returns a map of mapper functions associated with appropriate target type (
Class<?>. |
static final int PRIORITY
Config.Builder automatically.Map<Class<?>,Function<Config,?>> mappers()
Class<?>.
Mappers will by automatically registered by Config.Builder during
bootstrapping of Config unless
disableld.
null, though this may return an empty map if
mapper(Class) is used insteaddefault Map<GenericType<?>,BiFunction<Config,ConfigMapper,?>> genericTypeMappers()
GenericType<?>.
Mappers will by automatically registered by Config.Builder during
bootstrapping of Config unless
disableld.
null, though this may return an empty map if
mapper(Class) is used insteaddefault <T> Optional<Function<Config,T>> mapper(Class<T> type)
mapper(GenericType).T - type returned from conversiontype - type of the expected mapping resultdefault <T> Optional<BiFunction<Config,ConfigMapper,T>> mapper(GenericType<T> type)
GenericType.rawType().
Otherwise you have access to the (possibly) generics type of the expected result using
GenericType.type().
The mapping function has two parameters:
Config - config node to convert to the expected type
ConfigMapper - mapper to help with conversion of sub-nodes if neededT - type to map totype - type providing information what is the mapped typeCopyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.