org.sfm.jdbc
public final class JdbcMapperFactory extends Object
| Modifier and Type | Method and Description |
|---|---|
JdbcMapperFactory |
addAlias(String key,
String value)
Associate an alias on the column key to rename to value.
|
JdbcMapperFactory |
addAliases(Map<String,String> aliases)
Associate the aliases value to the column key.
|
JdbcMapperFactory |
addColumnDefinition(Predicate<? super JdbcColumnKey> predicate,
FieldMapperColumnDefinition<JdbcColumnKey,ResultSet> columnDefinition)
Associate the specified columnDefinition to the column matching the predicate.
|
JdbcMapperFactory |
addColumnDefinition(String key,
FieldMapperColumnDefinition<JdbcColumnKey,ResultSet> columnDefinition)
Associate the specified columnDefinition to the specified column.
|
JdbcMapperFactory |
addCustomFieldMapper(String key,
FieldMapper<ResultSet,?> fieldMapper)
Associate the specified FieldMapper for the specified column.
|
JdbcMapperFactory |
addCustomGetter(String key,
Getter<ResultSet,?> getter)
Associate the specified Getter for the specified column.
|
JdbcMapperFactory |
addKeys(String... columns)
Mark the specified columns as keys.
|
JdbcMapperFactory |
disableAsm(boolean disableAsm) |
JdbcMapperFactory |
failOnAsm(boolean b) |
JdbcMapperFactory |
fieldMapperErrorHandler(FieldMapperErrorHandler<JdbcColumnKey> fieldMapperErrorHandler)
the FieldMapperErrorHandler is called when a error occurred when mapping a field from the source to the target.
|
JdbcMapperFactory |
getterFactory(GetterFactory<ResultSet,JdbcColumnKey> getterFactory)
Override the default implementation of the GetterFactory used to get access to value from the ResultSet.
|
JdbcMapperFactory |
ignorePropertyNotFound()
Change the mapperBuilderErrorHandler to an IgnoreMapperBuilderErrorHandler.
|
JdbcMapperFactory |
mapperBuilderErrorHandler(MapperBuilderErrorHandler mapperBuilderErrorHandler)
Set the new MapperBuilderErrorHandler.
|
<T> JdbcMapperBuilder<T> |
newBuilder(Class<T> target)
Will create a instance of JdbcMapperBuilder on the specified target class.
|
<T> JdbcMapperBuilder<T> |
newBuilder(Type target)
Will create a instance of JdbcMapperBuilder on the specified type.
|
<T> JdbcMapperBuilder<T> |
newBuilder(TypeReference<T> target)
Will create a instance of JdbcMapperBuilder on the type T specified by the typeReference.
|
<T> DiscriminatorJdbcBuilder<T> |
newDiscriminator(String column)
Create a discriminator builder based on the specified column
|
static JdbcMapperFactory |
newInstance()
instantiate a new JdbcMapperFactory
|
<T> JdbcMapper<T> |
newMapper(Class<T> target)
Will create a DynamicMapper on the specified target class.
|
<T> JdbcMapper<T> |
newMapper(Class<T> target,
ResultSetMetaData metaData)
Will create a instance of JdbcMapper based on the specified metadata and the target class.
|
<T> JdbcMapper<T> |
newMapper(Type target)
Will create a DynamicMapper on the specified type.
|
<T> JdbcMapper<T> |
newMapper(TypeReference<T> target)
Will create a DynamicMapper on the type specified by the TypeReference.
|
JdbcMapperFactory |
propertyNameMatcherFactory(PropertyNameMatcherFactory propertyNameMatcherFactory)
Override the default PropertyNameMatcherFactory with the specified factory.
|
JdbcMapperFactory |
reflectionService(ReflectionService reflectionService)
Override the default implementation of the ReflectionService.
|
RowHandlerErrorHandler |
rowHandlerErrorHandler() |
JdbcMapperFactory |
rowHandlerErrorHandler(RowHandlerErrorHandler rowHandlerErrorHandler)
the RowHandlerErrorHandler is called when an exception is thrown by the RowHandler in the forEach call.
|
JdbcMapperFactory |
useAsm(boolean useAsm) |
public static JdbcMapperFactory newInstance()
public JdbcMapperFactory fieldMapperErrorHandler(FieldMapperErrorHandler<JdbcColumnKey> fieldMapperErrorHandler)
fieldMapperErrorHandler - the new FieldMapperErrorHandlerpublic JdbcMapperFactory ignorePropertyNotFound()
public JdbcMapperFactory mapperBuilderErrorHandler(MapperBuilderErrorHandler mapperBuilderErrorHandler)
mapperBuilderErrorHandler - the MapperBuilderErrorHandlerpublic JdbcMapperFactory rowHandlerErrorHandler(RowHandlerErrorHandler rowHandlerErrorHandler)
rowHandlerErrorHandler - the new RowHandlerErrorHandlerpublic JdbcMapperFactory useAsm(boolean useAsm)
useAsm - false if you want to disable asm generation of Mappers, Getter and Setter. This would be active by default if asm is present in a compatible version.public JdbcMapperFactory disableAsm(boolean disableAsm)
disableAsm - true if you want to disable asm for generation and to resolve constructor parameter names.public JdbcMapperFactory getterFactory(GetterFactory<ResultSet,JdbcColumnKey> getterFactory)
getterFactory - the getterFactorypublic JdbcMapperFactory reflectionService(ReflectionService reflectionService)
reflectionService - the overriding instancepublic <T> JdbcMapper<T> newMapper(Class<T> target, ResultSetMetaData metaData) throws SQLException
target - the target class of the mappermetaData - the metadata to create the mapper fromSQLExceptionpublic <T> JdbcMapperBuilder<T> newBuilder(Class<T> target)
target - the target classpublic <T> JdbcMapperBuilder<T> newBuilder(TypeReference<T> target)
target - the typeReferencepublic <T> JdbcMapperBuilder<T> newBuilder(Type target)
target - the typepublic <T> JdbcMapper<T> newMapper(Class<T> target)
target - the classpublic <T> JdbcMapper<T> newMapper(TypeReference<T> target)
target - the TypeReferencepublic <T> JdbcMapper<T> newMapper(Type target)
target - the typepublic JdbcMapperFactory addAlias(String key, String value)
key - the column to renamevalue - then name to rename topublic JdbcMapperFactory addCustomFieldMapper(String key, FieldMapper<ResultSet,?> fieldMapper)
key - the columnfieldMapper - the fieldmapperpublic JdbcMapperFactory addCustomGetter(String key, Getter<ResultSet,?> getter)
key - the columngetter - the getterpublic JdbcMapperFactory addColumnDefinition(String key, FieldMapperColumnDefinition<JdbcColumnKey,ResultSet> columnDefinition)
key - the columncolumnDefinition - the columnDefinitionpublic JdbcMapperFactory addColumnDefinition(Predicate<? super JdbcColumnKey> predicate, FieldMapperColumnDefinition<JdbcColumnKey,ResultSet> columnDefinition)
predicate - the column predicatecolumnDefinition - the columnDefinitionpublic JdbcMapperFactory propertyNameMatcherFactory(PropertyNameMatcherFactory propertyNameMatcherFactory)
propertyNameMatcherFactory - the factorypublic JdbcMapperFactory addAliases(Map<String,String> aliases)
aliases - the key value pairpublic JdbcMapperFactory failOnAsm(boolean b)
b - true if we want the builder to fail on asm generation failurepublic JdbcMapperFactory addKeys(String... columns)
columns - the columnspublic <T> DiscriminatorJdbcBuilder<T> newDiscriminator(String column)
T - the root type of the mappercolumn - the discriminator columnpublic RowHandlerErrorHandler rowHandlerErrorHandler()
Copyright © 2015. All rights reserved.