org.simpleflatmapper.map.mapper.ConstantSourceMapperBuilder Maven / Gradle / Ivy
Show all versions of sfm-map Show documentation
package org.simpleflatmapper.map.mapper;
import org.simpleflatmapper.map.FieldKey;
import org.simpleflatmapper.map.FieldMapper;
import org.simpleflatmapper.map.MapperConfig;
import org.simpleflatmapper.map.SourceFieldMapper;
import org.simpleflatmapper.map.context.MappingContextFactory;
import org.simpleflatmapper.map.context.MappingContextFactoryBuilder;
import org.simpleflatmapper.reflect.meta.ClassMeta;
import org.simpleflatmapper.reflect.meta.PropertyFinder;
import org.simpleflatmapper.reflect.meta.PropertyMeta;
import org.simpleflatmapper.util.ForEachCallBack;
import java.util.List;
public abstract class ConstantSourceMapperBuilder> {
@SuppressWarnings("unchecked")
public abstract ConstantSourceMapperBuilder addMapping(K key, ColumnDefinition columnDefinition);
protected abstract void addMapping(K columnKey, ColumnDefinition columnDefinition, PropertyMeta prop);
@SuppressWarnings("unchecked")
public abstract ContextualSourceFieldMapperImpl mapper();
public abstract SourceFieldMapper sourceFieldMapper();
public abstract boolean isRootAggregate();
public abstract MappingContextFactory super S> contextFactory();
public abstract void addMapper(FieldMapper mapper);
public abstract List getKeys();
public abstract >> H forEachProperties(H handler);
public static > ConstantSourceMapperBuilder newConstantSourceMapperBuilder(
MapperSource super S, K> mapperSource,
ClassMeta classMeta,
MapperConfig config,
MappingContextFactoryBuilder mappingContextFactoryBuilder,
KeyFactory keyFactory) {
return newConstantSourceMapperBuilder(mapperSource, classMeta, config, mappingContextFactoryBuilder, keyFactory, null);
}
public static > ConstantSourceMapperBuilder newConstantSourceMapperBuilder(
MapperSource super S, K> mapperSource,
ClassMeta classMeta, MapperConfig config,
MappingContextFactoryBuilder mappingContextFactoryBuilder,
KeyFactory keyFactory,
PropertyFinder propertyFinder) {
MapperConfig.Discriminator discriminator = config.getDiscriminator(classMeta);
if (discriminator == null) {
return new DefaultConstantSourceMapperBuilder(
mapperSource,
classMeta,
config,
mappingContextFactoryBuilder,
keyFactory,
propertyFinder);
} else {
return new DiscriminatorConstantSourceMapperBuilder(
discriminator,
mapperSource,
classMeta,
config,
mappingContextFactoryBuilder,
keyFactory,
propertyFinder
);
}
}
}