Package org.jdbi.v3.core.mapper
Class InferredRowMapperFactory
- java.lang.Object
-
- org.jdbi.v3.core.mapper.InferredRowMapperFactory
-
- All Implemented Interfaces:
RowMapperFactory
class InferredRowMapperFactory extends java.lang.Object implements RowMapperFactory
A generic RowMapperFactory that reflectively inspects aRowMapper<T>and maps only to columns of typeT. The type parameter T must be accessible via reflection or anUnsupportedOperationExceptionwill be thrown.
-
-
Constructor Summary
Constructors Constructor Description InferredRowMapperFactory(RowMapper<?> mapper)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<RowMapper<?>>build(java.lang.reflect.Type type, ConfigRegistry config)Supplies a row mapper which will map result set rows to type if the factory supports it; empty otherwise.(package private) static java.util.Optional<java.lang.reflect.Type>detectType(RowMapper<?> mapper)
-
-
-
Field Detail
-
maps
private final java.lang.reflect.Type maps
-
mapper
private final RowMapper<?> mapper
-
-
Constructor Detail
-
InferredRowMapperFactory
InferredRowMapperFactory(RowMapper<?> mapper)
-
-
Method Detail
-
detectType
static java.util.Optional<java.lang.reflect.Type> detectType(RowMapper<?> mapper)
-
build
public java.util.Optional<RowMapper<?>> build(java.lang.reflect.Type type, ConfigRegistry config)
Description copied from interface:RowMapperFactorySupplies a row mapper which will map result set rows to type if the factory supports it; empty otherwise.- Specified by:
buildin interfaceRowMapperFactory- Parameters:
type- the target type to map toconfig- the config registry, for composition- Returns:
- a row mapper for the given type if this factory supports it;
Optional.empty()otherwise. - See Also:
for composition
-
-