Class OptionalMapperFactory

  • All Implemented Interfaces:
    ColumnMapperFactory

    class OptionalMapperFactory
    extends java.lang.Object
    implements ColumnMapperFactory
    Column mapper factory which knows how to map Optionals:
    • Optional
    • OptionalInt
    • OptionalLong
    • OptionalDouble
    • Field Detail

      • STRATEGIES

        private static final java.util.Map<java.lang.Class<?>,​java.util.function.BiFunction<java.lang.reflect.Type,​ConfigRegistry,​ColumnMapper<?>>> STRATEGIES
    • Constructor Detail

      • OptionalMapperFactory

        OptionalMapperFactory()
    • Method Detail

      • build

        public java.util.Optional<ColumnMapper<?>> build​(java.lang.reflect.Type type,
                                                         ConfigRegistry config)
        Description copied from interface: ColumnMapperFactory
        Supplies a column mapper which will map columns to type if the factory supports it; empty otherwise.
        Specified by:
        build in interface ColumnMapperFactory
        Parameters:
        type - the target type to map to
        config - the config registry, for composition
        Returns:
        a column mapper for the given type if this factory supports it, or Optional.empty() otherwise.
        See Also:
        for composition
      • create

        static <Opt,​Box> ColumnMapper<?> create​(ColumnGetter<Box> columnGetter,
                                                      java.util.function.Supplier<Opt> empty,
                                                      java.util.function.Function<Box,​Opt> present)