Interface ConfigMapperProvider

    • Method Detail

      • mappers

        Map<Class<?>,​Function<Config,​?>> mappers()
        Returns a map of mapper functions associated with appropriate target type (Class<?>.

        Mappers will by automatically registered by Config.Builder during bootstrapping of Config unless disableld.

        Returns:
        a map of config mapper functions, never null, though this may return an empty map if mapper(Class) is used instead
      • genericTypeMappers

        default Map<GenericType<?>,​BiFunction<Config,​ConfigMapper,​?>> genericTypeMappers()
        Returns a map of mapper functions associated with appropriate target type (GenericType<?>.

        Mappers will by automatically registered by Config.Builder during bootstrapping of Config unless disableld.

        Returns:
        a map of config mapper functions, never null, though this may return an empty map if mapper(Class) is used instead
      • mapper

        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. If more complex type handling or conversion is needed, use mapper(GenericType).
        Type Parameters:
        T - type returned from conversion
        Parameters:
        type - type of the expected mapping result
        Returns:
        function to convert config node to the expected type, or empty if the type is not supported by this provider
      • mapper

        default <T> Optional<BiFunction<Config,​ConfigMapper,​T>> mapper​(GenericType<T> type)
        Mapper for a specific generic type. If your mapper only supports simple classes, get it using 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 needed
        and returns a typed value.
        Type Parameters:
        T - type to map to
        Parameters:
        type - type providing information what is the mapped type
        Returns:
        a function that would convert the provided Config instance into the expected type if supported by this provider, empty otherwise.