public abstract class AbstractMapperFactory<K extends FieldKey<K>,MF extends AbstractMapperFactory<K,MF,S>,S> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractMapperFactory.DiscriminatorBuilder<S,T> |
static class |
AbstractMapperFactory.DiscriminatorConditionBuilder<S,V,T> |
| Constructor and Description |
|---|
AbstractMapperFactory(AbstractColumnDefinitionProvider<K> columnDefinitions,
ColumnDefinition<K,?> identity) |
AbstractMapperFactory(AbstractMapperFactory<K,?,S> config) |
| Modifier and Type | Method and Description |
|---|---|
MF |
addAlias(String column,
String actualPropertyName)
Associate an alias on the property key to rename to value.
|
MF |
addAliases(Map<String,String> aliases)
Associate the aliases value to the property key.
|
MF |
addColumnDefinition(org.simpleflatmapper.util.Predicate<? super K> predicate,
ColumnDefinition<K,?> columnDefinition)
Associate the specified columnDefinition to the property matching the predicate.
|
MF |
addColumnDefinition(String column,
ColumnDefinition<K,?> columnDefinition)
Associate the specified columnDefinition to the specified property.
|
MF |
addColumnProperty(org.simpleflatmapper.util.Predicate<? super K> predicate,
Object... properties)
Associate the specified columnProperties to the property matching the predicate.
|
MF |
addColumnProperty(org.simpleflatmapper.util.Predicate<? super K> predicate,
org.simpleflatmapper.util.UnaryFactory<K,Object> propertyFactory)
Associate the specified columnProperties to the property matching the predicate.
|
MF |
addColumnProperty(String column,
Object... properties)
Associate the specified columnProperties to the property matching the predicate.
|
MF |
addKeys(String... columns)
Mark the specified columns as keys.
|
MF |
asmMapperNbFieldsLimit(int asmMapperNbFieldsLimit)
change the number of fields threshold after which an asm jdbcMapper is not generated.
|
MF |
assumeInjectionModifiesValues(boolean b)
if set to true, it will assume any constructor that takes a list as a constructor argument will need
to be mapped using a builder to protect against the actual value being changed in the constructor.
|
ColumnDefinitionProvider<K> |
columnDefinitions() |
ConsumerErrorHandler |
consumerErrorHandler() |
MF |
consumerErrorHandler(ConsumerErrorHandler consumerErrorHandler)
the ConsumerErrorHandler is called when an exception is thrown by the CheckedConsumer in the forEach call.
|
<T> MF |
discriminator(Class<T> commonType,
org.simpleflatmapper.util.Consumer<AbstractMapperFactory.DiscriminatorBuilder<S,T>> consumer) |
<T,V> MF |
discriminator(Class<T> commonType,
org.simpleflatmapper.reflect.Getter<? super S,? extends V> getter,
org.simpleflatmapper.util.Consumer<AbstractMapperFactory.DiscriminatorConditionBuilder<S,V,T>> consumer) |
<T,V> MF |
discriminator(Class<T> commonType,
String discriminatorColumn,
org.simpleflatmapper.util.CheckedBiFunction<S,String,V> discriminatorFieldAccessor,
org.simpleflatmapper.util.Consumer<AbstractMapperFactory.DiscriminatorConditionBuilder<S,V,T>> consumer) |
<T> MF |
discriminator(Type commonType,
org.simpleflatmapper.util.Consumer<AbstractMapperFactory.DiscriminatorBuilder<S,T>> consumer) |
<T,V> MF |
discriminator(Type commonType,
org.simpleflatmapper.reflect.Getter<? super S,? extends V> getter,
org.simpleflatmapper.util.Consumer<AbstractMapperFactory.DiscriminatorConditionBuilder<S,V,T>> consumer) |
<T,V> MF |
discriminator(Type commonType,
String discriminatorColumn,
org.simpleflatmapper.util.CheckedBiFunction<S,String,V> discriminatorFieldAccessor,
org.simpleflatmapper.util.Consumer<AbstractMapperFactory.DiscriminatorConditionBuilder<S,V,T>> consumer) |
AbstractColumnDefinitionProvider<K> |
enrichColumnDefinitions(AbstractColumnDefinitionProvider<K> columnDefinitions) |
MF |
failOnAsm(boolean b) |
MF |
fieldMapperErrorHandler(FieldMapperErrorHandler<K> fieldMapperErrorHandler)
the FieldMapperErrorHandler is called when a error occurred when mapping a field from the source to the target.
|
<T> org.simpleflatmapper.reflect.meta.ClassMeta<T> |
getClassMeta(Class<T> target) |
<T> org.simpleflatmapper.reflect.meta.ClassMeta<T> |
getClassMeta(Type target) |
<T> org.simpleflatmapper.reflect.meta.ClassMeta<T> |
getClassMeta(org.simpleflatmapper.util.TypeReference<T> target) |
<T> org.simpleflatmapper.reflect.meta.ClassMeta<T> |
getClassMetaWithExtraInstantiator(Class<T> target,
Member instantiator) |
<T> org.simpleflatmapper.reflect.meta.ClassMeta<T> |
getClassMetaWithExtraInstantiator(Type target,
Member instantiator) |
<T> org.simpleflatmapper.reflect.meta.ClassMeta<T> |
getClassMetaWithExtraInstantiator(org.simpleflatmapper.util.TypeReference<T> target,
Member instantiator) |
org.simpleflatmapper.reflect.ReflectionService |
getReflectionService() |
MF |
ignorePropertyNotFound()
Change the mapperBuilderErrorHandler to an IgnoreMapperBuilderErrorHandler.
|
MF |
mapperBuilderErrorHandler(MapperBuilderErrorHandler mapperBuilderErrorHandler)
Set the new MapperBuilderErrorHandler.
|
MapperConfig<K,S> |
mapperConfig() |
MF |
maxMethodSize(int maxMethodSize)
Number needs to be a power of 2, do not use if you don't know what it does.
|
MF |
propertyNameMatcherFactory(PropertyNameMatcherFactory propertyNameMatcherFactory)
Override the default PropertyNameMatcherFactory with the specified factory.
|
MF |
reflectionService(org.simpleflatmapper.reflect.ReflectionService reflectionService)
Override the default implementation of the ReflectionService.
|
MF |
rowHandlerErrorHandler(ConsumerErrorHandler rowHandlerErrorHandler)
Deprecated.
|
MF |
useAsm(boolean useAsm) |
public AbstractMapperFactory(AbstractMapperFactory<K,?,S> config)
public AbstractMapperFactory(AbstractColumnDefinitionProvider<K> columnDefinitions, ColumnDefinition<K,?> identity)
public final MF fieldMapperErrorHandler(FieldMapperErrorHandler<K> fieldMapperErrorHandler)
fieldMapperErrorHandler - the new FieldMapperErrorHandlerpublic final MF ignorePropertyNotFound()
public final MF mapperBuilderErrorHandler(MapperBuilderErrorHandler mapperBuilderErrorHandler)
mapperBuilderErrorHandler - the MapperBuilderErrorHandlerpublic final MF consumerErrorHandler(ConsumerErrorHandler consumerErrorHandler)
consumerErrorHandler - the new ConsumerErrorHandler@Deprecated public final MF rowHandlerErrorHandler(ConsumerErrorHandler rowHandlerErrorHandler)
public final MF 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 final MF reflectionService(org.simpleflatmapper.reflect.ReflectionService reflectionService)
reflectionService - the overriding newInstancepublic final MapperConfig<K,S> mapperConfig()
public AbstractColumnDefinitionProvider<K> enrichColumnDefinitions(AbstractColumnDefinitionProvider<K> columnDefinitions)
public final MF addAlias(String column, String actualPropertyName)
column - the column name to renameactualPropertyName - then name to rename to match the actual property namepublic final MF addColumnDefinition(String column, ColumnDefinition<K,?> columnDefinition)
column - the name of the columncolumnDefinition - the columnDefinitionpublic final MF addColumnDefinition(org.simpleflatmapper.util.Predicate<? super K> predicate, ColumnDefinition<K,?> columnDefinition)
predicate - the property predicatecolumnDefinition - the columnDefinitionpublic final MF addColumnProperty(String column, Object... properties)
column - the column nameproperties - the propertiespublic final MF addColumnProperty(org.simpleflatmapper.util.Predicate<? super K> predicate, Object... properties)
predicate - the property predicateproperties - the propertiespublic final MF addColumnProperty(org.simpleflatmapper.util.Predicate<? super K> predicate, org.simpleflatmapper.util.UnaryFactory<K,Object> propertyFactory)
predicate - the property predicatepropertyFactory - the propertiespublic final MF propertyNameMatcherFactory(PropertyNameMatcherFactory propertyNameMatcherFactory)
propertyNameMatcherFactory - the factorypublic final MF addAliases(Map<String,String> aliases)
aliases - the key value pairpublic final MF failOnAsm(boolean b)
b - true if we want the builder to fail on asm generation failurepublic final MF assumeInjectionModifiesValues(boolean b)
b - true to make the factory being paranoid about constructor injection of aggregationpublic final MF asmMapperNbFieldsLimit(int asmMapperNbFieldsLimit)
the default value is calculated from the benchmark results, currently 240.
asmMapperNbFieldsLimit - the limit after which it does not use asm for the jdbcMapper.public final MF maxMethodSize(int maxMethodSize)
maxMethodSize - the max method size, needs be a power of 2.public final MF addKeys(String... columns)
columns - the columnspublic final ConsumerErrorHandler consumerErrorHandler()
public final <T> org.simpleflatmapper.reflect.meta.ClassMeta<T> getClassMeta(org.simpleflatmapper.util.TypeReference<T> target)
public final <T> org.simpleflatmapper.reflect.meta.ClassMeta<T> getClassMeta(Class<T> target)
public final <T> org.simpleflatmapper.reflect.meta.ClassMeta<T> getClassMeta(Type target)
public final <T> org.simpleflatmapper.reflect.meta.ClassMeta<T> getClassMetaWithExtraInstantiator(org.simpleflatmapper.util.TypeReference<T> target,
Member instantiator)
public final <T> org.simpleflatmapper.reflect.meta.ClassMeta<T> getClassMetaWithExtraInstantiator(Class<T> target, Member instantiator)
public final <T> org.simpleflatmapper.reflect.meta.ClassMeta<T> getClassMetaWithExtraInstantiator(Type target, Member instantiator)
public org.simpleflatmapper.reflect.ReflectionService getReflectionService()
public ColumnDefinitionProvider<K> columnDefinitions()
public <T> MF discriminator(Type commonType, org.simpleflatmapper.util.Consumer<AbstractMapperFactory.DiscriminatorBuilder<S,T>> consumer)
public <T,V> MF discriminator(Type commonType, org.simpleflatmapper.reflect.Getter<? super S,? extends V> getter, org.simpleflatmapper.util.Consumer<AbstractMapperFactory.DiscriminatorConditionBuilder<S,V,T>> consumer)
public <T> MF discriminator(Class<T> commonType, org.simpleflatmapper.util.Consumer<AbstractMapperFactory.DiscriminatorBuilder<S,T>> consumer)
public <T,V> MF discriminator(Class<T> commonType, org.simpleflatmapper.reflect.Getter<? super S,? extends V> getter, org.simpleflatmapper.util.Consumer<AbstractMapperFactory.DiscriminatorConditionBuilder<S,V,T>> consumer)
public <T,V> MF discriminator(Class<T> commonType, String discriminatorColumn, org.simpleflatmapper.util.CheckedBiFunction<S,String,V> discriminatorFieldAccessor, org.simpleflatmapper.util.Consumer<AbstractMapperFactory.DiscriminatorConditionBuilder<S,V,T>> consumer)
Copyright © 2018. All rights reserved.