public class MappingContext extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MappingContext.Factory
Factory constructs instances of the base MappingContext
|
static class |
MappingContext.StackElement |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
capturesFieldContext |
protected boolean |
containsCycle |
protected int |
depth |
protected List<Object[]> |
fieldMappingStack |
protected Map<Object,Object> |
globalProperties |
protected boolean |
isNew |
protected List<Map<MapperKey,ClassMap<?,?>>> |
mappersSeen |
protected Map<Type<?>,Type<?>> |
mapping |
protected Map<Object,Object> |
properties |
protected Type<?> |
resolvedDestinationType |
protected Type<?> |
resolvedSourceType |
protected MappingStrategy |
resolvedStrategy |
protected OpenIntObjectHashMap |
typeCache |
| Constructor and Description |
|---|
MappingContext(Map<Object,Object> globalProperties)
Constructs a new MappingContext with the specified (immutable) global
properties;
|
| Modifier and Type | Method and Description |
|---|---|
void |
beginMapping()
Deprecated.
This variant exists for backwards compatibility only; if
overriding, override
beginMapping(Type, Object, Type, Object) instead. |
void |
beginMapping(Type<?> sourceType,
Object source,
Type<?> destType,
Object dest)
Deprecated.
This variant exists for backwards compatibility only; if
overriding, override
#beginMapping(Type, String, Object, Type, String, Object)
instead. |
void |
beginMappingField(String sourceName,
Type<?> sourceType,
Object source,
String destName,
Type<?> destType,
Object dest)
Mark the start of mapping a particular field
|
<S,D> void |
cacheMappedObject(S source,
Type<Object> destinationType,
D destination)
Caches an object instance which has been mapped for a particular source
instance and destination type in this mapping context; this will later be
referenced in avoiding infinite recursion mapping the same object.
|
boolean |
containsCycle() |
void |
containsCycle(boolean containsCycle)
Sets whether this MappingContext needs to guard against cycles when
mapping the current object graph; specifying
false when
applicable can lend improved performance. |
void |
endMapping()
Mark the end of a particular mapping
|
void |
endMappingField() |
<S,D> Type<? extends D> |
getConcreteClass(Type<S> sourceType,
Type<D> destinationType)
Searches for a concrete class that has been registered for the given
abstract class or interface within this mapping session.
|
int |
getDepth() |
String[] |
getDestinationExpressionPaths() |
Object[] |
getDestinationObjects() |
Type[] |
getDestinationTypePaths() |
String |
getFullyQualifiedDestinationPath() |
String |
getFullyQualifiedSourcePath() |
<D> D |
getMappedObject(Object source,
Type<?> destinationType)
Looks for an object which has already been mapped for the source and
destination type in this context.
|
ClassMap<?,?> |
getMapperGeneration(MapperKey mapperKey)
Looks up a ClassMap among the mappers generated with this mapping context
|
Object |
getProperty(Object key)
Get a property set on the current mapping context; individual properties
set on this context instance are checked first, followed by global
properties.
|
Type<?> |
getResolvedDestinationType() |
Type<?> |
getResolvedSourceType() |
MappingStrategy |
getResolvedStrategy() |
String[] |
getSourceExpressionPaths() |
Object[] |
getSourceObjects() |
Type[] |
getSourceTypePaths() |
void |
registerConcreteClass(Type<?> subjectClass,
Type<?> concreteClass)
Registers a concrete class to be used for the given abstract class or
interface within this mapping session only.
|
void |
registerMapperGeneration(ClassMap<?,?> classMap)
Registers a ClassMap marking it as mapped within the current context;
|
void |
reset()
Resets this context instance, in preparation for use by another mapping
request
|
void |
setProperty(Object key,
Object value)
Sets an instance property on this MappingContext
|
void |
setResolvedDestinationType(Type<?> resolvedDestinationType) |
void |
setResolvedSourceType(Type<?> resolvedSourceType) |
void |
setResolvedStrategy(MappingStrategy resolvedStrategy) |
protected final OpenIntObjectHashMap typeCache
protected boolean isNew
protected boolean containsCycle
protected int depth
protected Type<?> resolvedSourceType
protected Type<?> resolvedDestinationType
protected MappingStrategy resolvedStrategy
protected boolean capturesFieldContext
public void containsCycle(boolean containsCycle)
false when
applicable can lend improved performance.containsCycle - public boolean containsCycle()
public int getDepth()
public <S,D> Type<? extends D> getConcreteClass(Type<S> sourceType, Type<D> destinationType)
sourceType - destinationType - public void registerConcreteClass(Type<?> subjectClass, Type<?> concreteClass)
subjectClass - concreteClass - public <S,D> void cacheMappedObject(S source,
Type<Object> destinationType,
D destination)
source - destinationType - destination - public <D> D getMappedObject(Object source, Type<?> destinationType)
source - destinationType - public void registerMapperGeneration(ClassMap<?,?> classMap)
classMap - public ClassMap<?,?> getMapperGeneration(MapperKey mapperKey)
mapperKey - @Deprecated public void beginMapping()
beginMapping(Type, Object, Type, Object) instead.@Deprecated public void beginMapping(Type<?> sourceType, Object source, Type<?> destType, Object dest)
#beginMapping(Type, String, Object, Type, String, Object)
instead.sourceType - the type of the source object being mappedsource - the source object being mappeddestType - the type of the destination object being mapped intodest - the destination object being mapped intopublic void beginMappingField(String sourceName, Type<?> sourceType, Object source, String destName, Type<?> destType, Object dest)
sourceType - the type of the source fieldsourceName - the name of the source fieldsource - the source object being mappeddestType - the type of the destination object being mapped intodestName - the name of the destination fielddest - the destination object being mapped intopublic void endMappingField()
public String getFullyQualifiedSourcePath()
public String[] getSourceExpressionPaths()
public Object[] getSourceObjects()
public Type[] getSourceTypePaths()
public String getFullyQualifiedDestinationPath()
public String[] getDestinationExpressionPaths()
public Object[] getDestinationObjects()
public Type[] getDestinationTypePaths()
public void endMapping()
public void reset()
public void setProperty(Object key, Object value)
key - value - public Object getProperty(Object key)
key - public Type<?> getResolvedSourceType()
public void setResolvedSourceType(Type<?> resolvedSourceType)
resolvedSourceType - the resolvedSourceType to setpublic Type<?> getResolvedDestinationType()
public void setResolvedDestinationType(Type<?> resolvedDestinationType)
resolvedDestinationType - the resolvedDestinationType to setpublic MappingStrategy getResolvedStrategy()
public void setResolvedStrategy(MappingStrategy resolvedStrategy)
resolvedStrategy - the mapping strategy to setCopyright © 2016 Glasnost. All rights reserved.