Class InferredRowMapperFactory

java.lang.Object
org.jdbi.v3.core.mapper.InferredRowMapperFactory
All Implemented Interfaces:
RowMapperFactory

class InferredRowMapperFactory extends Object implements RowMapperFactory
A generic RowMapperFactory that reflectively inspects a RowMapper<T> and maps only to columns of type T. The type parameter T must be accessible via reflection or an UnsupportedOperationException will be thrown.
  • Field Details

    • maps

      private final Type maps
    • mapper

      private final RowMapper<?> mapper
  • Constructor Details

    • InferredRowMapperFactory

      InferredRowMapperFactory(RowMapper<?> mapper)
  • Method Details

    • detectType

      static Optional<Type> detectType(RowMapper<?> mapper)
    • build

      public Optional<RowMapper<?>> build(Type type, ConfigRegistry config)
      Description copied from interface: RowMapperFactory
      Supplies a row mapper which will map result set rows to type if the factory supports it; empty otherwise.
      Specified by:
      build in interface RowMapperFactory
      Parameters:
      type - the target type to map to
      config - the config registry, for composition
      Returns:
      a row mapper for the given type if this factory supports it; Optional.empty() otherwise.
      See Also: