A - B - public class ClassMapBuilder<A,B> extends Object implements MappedTypePair<A,B>
| Modifier and Type | Class and Description |
|---|---|
static class |
ClassMapBuilder.Factory |
| Modifier | Constructor and Description |
|---|---|
protected |
ClassMapBuilder(Type<A> aType,
Type<B> bType,
MapperFactory mapperFactory,
PropertyResolverStrategy propertyResolver,
DefaultFieldMapper... defaults) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addFieldMap(FieldMap fieldMap) |
ClassMapBuilder<A,B> |
byDefault(DefaultFieldMapper... withDefaults)
Configures this class-map builder to employ the default property mapping
behavior to any properties that have not already been mapped or excluded;
if any DefaultFieldMapper instances are passed, they will be used
(instead of those configured on the builder) to attempt a property name
match if a direct match is not found.
|
ClassMapBuilder<A,B> |
byDefault(MappingDirection direction,
DefaultFieldMapper... withDefaults)
Configures this class-map builder to employ the default property mapping
behavior to any properties that have not already been mapped or excluded;
if any DefaultFieldMapper instances are passed, they will be used
(instead of those configured on the builder) to attempt a property name
match if a direct match is not found.
|
ClassMapBuilder<A,B> |
byDefault(MappingHint[] mappingHints)
Deprecated.
use
byDefault(DefaultFieldMapper...) instead |
ClassMapBuilder<A,B> |
byDefault(MappingHint hint0,
MappingHint... mappingHints)
Deprecated.
use
byDefault(DefaultFieldMapper...) instead |
ClassMapBuilder<A,B> |
constructorA(String... args)
Declares a constructor to be used for the A type with the specified
arguments.
|
ClassMapBuilder<A,B> |
constructorB(String... args)
Declares a constructor to be used for the B type with the specified
arguments.
|
ClassMapBuilder<A,B> |
customize(Mapper<A,B> customizedMapper)
Set the custom mapper to use for this mapping.
|
ClassMapBuilder<A,B> |
customize(MapperBase<A,B> legacyCustomizedMapper)
Deprecated.
use
customize(Mapper) instead |
protected String |
describeClassMap() |
ClassMapBuilder<A,B> |
exclude(String fieldName)
Exclude the specified field from mapping
|
ClassMapBuilder<A,B> |
favorExtension(boolean favorsExtension) |
ClassMapBuilder<A,B> |
field(Property.Builder fieldA,
Property.Builder fieldB) |
ClassMapBuilder<A,B> |
field(Property.Builder fieldA,
String fieldNameB)
Maps 'fieldA' of type A to 'fieldB' of type B.
|
ClassMapBuilder<A,B> |
field(Property fieldA,
Property fieldB) |
ClassMapBuilder<A,B> |
field(Property fieldA,
String fieldNameB) |
ClassMapBuilder<A,B> |
field(String fieldNameA,
Property.Builder fieldB) |
ClassMapBuilder<A,B> |
field(String fieldNameA,
Property fieldB) |
ClassMapBuilder<A,B> |
field(String fieldNameA,
String fieldNameB)
Map a field in both directions
|
ClassMapBuilder<A,B> |
fieldAToB(String fieldNameA,
String fieldNameB)
Map a field in one direction only (from fieldNameA to fieldNameB)
|
ClassMapBuilder<A,B> |
fieldBToA(String fieldNameB,
String fieldNameA)
Map a field in one direction only (from fieldNameB to fieldNameA)
|
FieldMapBuilder<A,B> |
fieldMap(Property.Builder fieldA,
Property.Builder fieldB,
boolean byDefault) |
FieldMapBuilder<A,B> |
fieldMap(Property.Builder fieldA,
String fieldNameB,
boolean byDefault) |
FieldMapBuilder<A,B> |
fieldMap(Property fieldA,
Property fieldB,
boolean byDefault) |
FieldMapBuilder<A,B> |
fieldMap(Property fieldA,
String fieldNameB,
boolean byDefault) |
FieldMapBuilder<A,B> |
fieldMap(String a)
Create a fieldMap for the particular field (same property name used in
both types)
|
FieldMapBuilder<A,B> |
fieldMap(String a,
boolean byDefault)
Create a fieldMap for the particular field (same property name used in
both types)
|
FieldMapBuilder<A,B> |
fieldMap(String fieldNameA,
Property.Builder fieldB,
boolean byDefault) |
FieldMapBuilder<A,B> |
fieldMap(String fieldNameA,
Property fieldB,
boolean byDefault) |
FieldMapBuilder<A,B> |
fieldMap(String fieldNameA,
String fieldNameB)
Create a fieldMap for the particular field mapping
|
FieldMapBuilder<A,B> |
fieldMap(String fieldNameA,
String fieldNameB,
boolean byDefault)
Create a fieldMap for the particular field mapping
|
Type<A> |
getAType() |
Type<B> |
getBType() |
protected DefaultFieldMapper[] |
getDefaultFieldMappers() |
protected Set<FieldMap> |
getMappedFields() |
protected Set<String> |
getMappedPropertiesForTypeA() |
protected Set<String> |
getMappedPropertiesForTypeB() |
protected Set<String> |
getPropertiesForTypeA() |
protected Set<String> |
getPropertiesForTypeB() |
protected Map<String,Property> |
getPropertyExpressions(Type<?> type)
Gets all of the property expressions for a given type, including all
nested properties.
|
protected PropertyResolverStrategy |
getPropertyResolver() |
protected boolean |
isNestedPropertyExpression(String expression)
Determines whether the provided string is a valid property expression
|
static <A,B> ClassMapBuilder<A,B> |
map(Class<A> aType,
Class<B> bType)
Deprecated.
use
MapperFactory.classMap(Class, Class)
instead |
static <A,B> ClassMapBuilder<A,B> |
map(Class<A> aType,
Type<B> bType)
Deprecated.
use
MapperFactory.classMap(Class, Type)
instead |
static <A,B> ClassMapBuilder<A,B> |
map(Type<A> aType,
Class<B> bType)
Deprecated.
use
MapperFactory.classMap(Type, Class)
instead |
static <A,B> ClassMapBuilder<A,B> |
map(Type<A> aType,
Type<B> bType)
Deprecated.
use
MapperFactory.classMap(Type, Type)
instead |
ClassMapBuilder<A,B> |
mapNulls(boolean destinationsMappedOnNull) |
ClassMapBuilder<A,B> |
mapNullsInReverse(boolean sourcesMappedOnNull) |
void |
register()
Registers the ClassMap defined by this builder with it's initiating
MapperFactory
|
protected Property |
resolveProperty(Type type,
String expr)
Resolves a property for the particular type, based on the provided
property expression
|
protected Property |
resolvePropertyForA(String expr)
Resolves a property expression for this builder's 'A' type
|
protected Property |
resolvePropertyForB(String expr)
Resolves a property expression for this builder's 'B' type
|
ClassMap<A,B> |
toClassMap()
Produces a ClassMap instance based on the configurations defined on this
ClassMapBuilder.
|
String |
toString() |
<X,Y> ClassMapBuilder<A,B> |
use(Class<?> aParentClass,
Class<?> bParentClass)
Configure this ClassMapBuilder to use an existing mapping (for parent
classes) defined from
aParentClass to
bParentClass. |
<X,Y> ClassMapBuilder<A,B> |
use(Type<?> aParentType,
Type<?> bParentType)
Configure this ClassMapBuilder to use an existing mapping (for parent
classes) defined from
aParentClass to
bParentClass. |
protected ClassMapBuilder(Type<A> aType, Type<B> bType, MapperFactory mapperFactory, PropertyResolverStrategy propertyResolver, DefaultFieldMapper... defaults)
aType - bType - propertyResolver - defaults - protected Map<String,Property> getPropertyExpressions(Type<?> type)
type - the type for which to gather propertiespublic ClassMapBuilder<A,B> field(String fieldNameA, String fieldNameB)
fieldNameA - property name in type AfieldNameB - property name in type Bpublic ClassMapBuilder<A,B> fieldAToB(String fieldNameA, String fieldNameB)
fieldNameA - the (source) fieldName from type AfieldNameB - the (destination) fieldName from type Bpublic ClassMapBuilder<A,B> fieldBToA(String fieldNameB, String fieldNameA)
fieldNameB - the (source) fieldName from type BfieldNameA - the (destination) fieldName from type Apublic FieldMapBuilder<A,B> fieldMap(String a)
a - public FieldMapBuilder<A,B> fieldMap(String a, boolean byDefault)
a - byDefault - public FieldMapBuilder<A,B> fieldMap(String fieldNameA, String fieldNameB)
fieldNameA - the name of the field in type AfieldNameB - the name of the field in type Bpublic FieldMapBuilder<A,B> fieldMap(String fieldNameA, String fieldNameB, boolean byDefault)
fieldNameA - the name of the field in type AfieldNameB - the name of the field in type BbyDefault - whether the field mapping has been provided by defaultpublic FieldMapBuilder<A,B> fieldMap(Property fieldA, Property fieldB, boolean byDefault)
fieldA - fieldB - byDefault - public FieldMapBuilder<A,B> fieldMap(String fieldNameA, Property fieldB, boolean byDefault)
fieldA - fieldB - byDefault - public FieldMapBuilder<A,B> fieldMap(Property fieldA, String fieldNameB, boolean byDefault)
fieldA - fieldNameB - byDefault - public FieldMapBuilder<A,B> fieldMap(Property.Builder fieldA, Property.Builder fieldB, boolean byDefault)
fieldA - fieldB - byDefault - public FieldMapBuilder<A,B> fieldMap(String fieldNameA, Property.Builder fieldB, boolean byDefault)
fieldA - fieldB - byDefault - public FieldMapBuilder<A,B> fieldMap(Property.Builder fieldA, String fieldNameB, boolean byDefault)
fieldA - fieldNameB - byDefault - public ClassMapBuilder<A,B> field(Property fieldA, Property fieldB)
fieldA - fieldB - byDefault - public ClassMapBuilder<A,B> field(String fieldNameA, Property fieldB)
fieldA - fieldB - byDefault - public ClassMapBuilder<A,B> field(Property fieldA, String fieldNameB)
fieldA - fieldNameB - byDefault - public ClassMapBuilder<A,B> field(Property.Builder fieldA, Property.Builder fieldB)
fieldA - fieldB - byDefault - public ClassMapBuilder<A,B> field(String fieldNameA, Property.Builder fieldB)
fieldNameA - fieldB - byDefault - public ClassMapBuilder<A,B> field(Property.Builder fieldA, String fieldNameB)
fieldA - fieldNameB - byDefault - public ClassMapBuilder<A,B> exclude(String fieldName)
fieldName - the name of the field/property to exclude@Deprecated public final ClassMapBuilder<A,B> customize(MapperBase<A,B> legacyCustomizedMapper)
customize(Mapper) insteadlegacyCustomizedMapper - public ClassMapBuilder<A,B> customize(Mapper<A,B> customizedMapper)
customizedMapper - public <X,Y> ClassMapBuilder<A,B> use(Class<?> aParentClass, Class<?> bParentClass)
aParentClass to
bParentClass.aParentClass - the source class of the parent mappingbParentClass - the destination class of the parent mappingpublic <X,Y> ClassMapBuilder<A,B> use(Type<?> aParentType, Type<?> bParentType)
aParentClass to
bParentClass.aParentType - the source type of the parent mappingbParentType - the destination type of the parent mappingpublic ClassMapBuilder<A,B> byDefault(DefaultFieldMapper... withDefaults)
withDefaults - zero or more DefaultFieldMapper instances to apply during the
default mapping; if none are supplied, the configured
DefaultFieldMappers for the builder (if any) should be used.public ClassMapBuilder<A,B> byDefault(MappingDirection direction, DefaultFieldMapper... withDefaults)
direction - the mapping direction to be appliedwithDefaults - zero or more DefaultFieldMapper instances to apply during the
default mapping; if none are supplied, the configured
DefaultFieldMappers for the builder (if any) should be used.@Deprecated public final ClassMapBuilder<A,B> byDefault(MappingHint hint0, MappingHint... mappingHints)
byDefault(DefaultFieldMapper...) insteadhint0 - first hintmappingHints - remaining hints@Deprecated public final ClassMapBuilder<A,B> byDefault(MappingHint[] mappingHints)
byDefault(DefaultFieldMapper...) insteadmappingHints - public ClassMap<A,B> toClassMap()
public ClassMapBuilder<A,B> mapNulls(boolean destinationsMappedOnNull)
destinationsMappedOnNull - true|false to indicate whether the destination properties of
this class map's fields should be set to null (when mapping in
the forward direction) if the source property's value is nullpublic ClassMapBuilder<A,B> mapNullsInReverse(boolean sourcesMappedOnNull)
sourcesMappedOnNull - true|false to indicate whether the source properties of this
class map's fields should be set to null (when mapping in the
reverse direction) if the destination property's value is nullpublic ClassMapBuilder<A,B> favorExtension(boolean favorsExtension)
favorsExtension - true|false indicating whether the class-map defined by this
builder should be considered 'abstract', meaning that it is
not usable independently, but can contribute to the definition
of mappers that inherit from it based on the mapped types.public void register()
protected String describeClassMap()
public static final <A,B> ClassMapBuilder<A,B> map(Class<A> aType, Class<B> bType)
MapperFactory.classMap(Class, Class)
insteadaType and bType.aType - bType - public static final <A,B> ClassMapBuilder<A,B> map(Type<A> aType, Type<B> bType)
MapperFactory.classMap(Type, Type)
insteadaType - bType - public static final <A,B> ClassMapBuilder<A,B> map(Class<A> aType, Type<B> bType)
MapperFactory.classMap(Class, Type)
insteadaType - bType - public static final <A,B> ClassMapBuilder<A,B> map(Type<A> aType, Class<B> bType)
MapperFactory.classMap(Type, Class)
insteadaType - bType - protected boolean isNestedPropertyExpression(String expression)
expression - the expression to evaluateprotected Property resolveProperty(Type type, String expr)
type - the type to resolveexpr - the property expression to resolveprotected Property resolvePropertyForA(String expr)
expr - the property expressionprotected Property resolvePropertyForB(String expr)
expr - the property expressionpublic Type<A> getAType()
getAType in interface MappedTypePair<A,B>public Type<B> getBType()
getBType in interface MappedTypePair<A,B>protected void addFieldMap(FieldMap fieldMap)
fieldMap - protected Set<String> getMappedPropertiesForTypeA()
protected Set<String> getMappedPropertiesForTypeB()
protected Set<FieldMap> getMappedFields()
protected Set<String> getPropertiesForTypeA()
protected Set<String> getPropertiesForTypeB()
protected DefaultFieldMapper[] getDefaultFieldMappers()
protected PropertyResolverStrategy getPropertyResolver()
public ClassMapBuilder<A,B> constructorA(String... args)
args - the arguments identifying the constructor to be usedpublic ClassMapBuilder<A,B> constructorB(String... args)
args - the arguments identifying the constructor to be usedCopyright © 2016 Glasnost. All rights reserved.