Package org.jdbi.v3.core.mapper.reflect
Class BeanMapper<T>
- java.lang.Object
-
- org.jdbi.v3.core.mapper.reflect.internal.PojoMapper<T>
-
- org.jdbi.v3.core.mapper.reflect.BeanMapper<T>
-
- All Implemented Interfaces:
RowMapper<T>
public final class BeanMapper<T> extends PojoMapper<T>
A row mapper which maps the columns in a statement into a JavaBean. The default implementation will perform a case insensitive mapping between the bean property names and the column labels, also considering camel-case to underscores conversion. This uses the JDK's built in bean mapping facilities, so it does not support nested properties. The mapped class must have a default constructor.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringDEFAULT_PREFIX-
Fields inherited from class org.jdbi.v3.core.mapper.reflect.internal.PojoMapper
prefix, strictColumnTypeMapping, type
-
-
Constructor Summary
Constructors Modifier Constructor Description privateBeanMapper(java.lang.Class<T> type, java.lang.String prefix)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BeanMapper<?>createNestedMapper(StatementContext ctx, PojoProperties.PojoProperty<T> property, java.lang.String nestedPrefix)static RowMapperFactoryfactory(java.lang.Class<?> type)Returns a mapper factory that maps to the given bean classstatic RowMapperFactoryfactory(java.lang.Class<?> type, java.lang.String prefix)Returns a mapper factory that maps to the given bean classprotected PojoProperties<T>getProperties(ConfigRegistry config)static <T> RowMapper<T>of(java.lang.Class<T> type)Returns a mapper for the given bean classstatic <T> RowMapper<T>of(java.lang.Class<T> type, java.lang.String prefix)Returns a mapper for the given bean class-
Methods inherited from class org.jdbi.v3.core.mapper.reflect.internal.PojoMapper
map, specialize
-
-
-
-
Field Detail
-
DEFAULT_PREFIX
static final java.lang.String DEFAULT_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BeanMapper
private BeanMapper(java.lang.Class<T> type, java.lang.String prefix)
-
-
Method Detail
-
factory
public static RowMapperFactory factory(java.lang.Class<?> type)
Returns a mapper factory that maps to the given bean class- Parameters:
type- the mapped class- Returns:
- a mapper factory that maps to the given bean class
-
factory
public static RowMapperFactory factory(java.lang.Class<?> type, java.lang.String prefix)
Returns a mapper factory that maps to the given bean class- Parameters:
type- the mapped classprefix- the column name prefix for each mapped bean property- Returns:
- a mapper factory that maps to the given bean class
-
of
public static <T> RowMapper<T> of(java.lang.Class<T> type)
Returns a mapper for the given bean class- Type Parameters:
T- the type to find the mapper for- Parameters:
type- the mapped class- Returns:
- a mapper for the given bean class
-
of
public static <T> RowMapper<T> of(java.lang.Class<T> type, java.lang.String prefix)
Returns a mapper for the given bean class- Type Parameters:
T- the type to find the mapper for- Parameters:
type- the mapped classprefix- the column name prefix for each mapped bean property- Returns:
- a mapper for the given bean class
-
getProperties
protected PojoProperties<T> getProperties(ConfigRegistry config)
- Overrides:
getPropertiesin classPojoMapper<T>
-
createNestedMapper
protected BeanMapper<?> createNestedMapper(StatementContext ctx, PojoProperties.PojoProperty<T> property, java.lang.String nestedPrefix)
- Overrides:
createNestedMapperin classPojoMapper<T>
-
-