Package org.modelmapper.spi
Interface MappingContext<S,D>
-
public interface MappingContext<S,D>
Maintains context during the mapping of a source object of typeS
to a destination object of typeD
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <CS,CD>
MappingContext<CS,CD>create(CS source, CD destination)
Creates a new child MappingContext for thesource
anddestination
which inherits all other information from the this MappingContext.<CS,CD>
MappingContext<CS,CD>create(CS source, Class<CD> destinationType)
Creates a new child MappingContext for thesource
anddestinationType
which inherits all other information from the this MappingContext.<CS,CD>
MappingContext<CS,CD>create(CS source, Type destinationType)
Creates a new child MappingContext for thesource
anddestinationType
which inherits all other information from the this MappingContext.D
getDestination()
Returns the destination object being mapped to or null if the destination has not yet been initialized.Class<D>
getDestinationType()
Returns the destination type being mapped to.Type
getGenericDestinationType()
Returns the generic destination type.Mapping
getMapping()
Returns the mapping associated with the mapping request elsenull
if the request did not originate from aTypeMap
.MappingEngine
getMappingEngine()
Returns the MappingEngine that initiated the mapping request.MappingContext<?,?>
getParent()
Returns the parent MappingContext from which the current MappingContext was created, elsenull
if there is no parent context.S
getSource()
Returns the source object being mapped from.Class<S>
getSourceType()
Returns the source type being mapped from.TypeMap<S,D>
getTypeMap()
Returns the TypeMap associated with the mapping request elsenull
if the request did not originate from a TypeMap.String
getTypeMapName()
Returns the name of the TypeMap associated with the mapping request elsenull
if the request did not originate from a named TypeMap.
-
-
-
Method Detail
-
create
<CS,CD> MappingContext<CS,CD> create(CS source, CD destination)
Creates a new child MappingContext for thesource
anddestination
which inherits all other information from the this MappingContext.- Type Parameters:
CS
- child source typeCD
- child destination type- Parameters:
source
- to map fromdestination
- to map to- Returns:
- new child MappingContext
- Throws:
IllegalArgumentException
- ifsource
ordestination
are null
-
create
<CS,CD> MappingContext<CS,CD> create(CS source, Class<CD> destinationType)
Creates a new child MappingContext for thesource
anddestinationType
which inherits all other information from the this MappingContext.- Type Parameters:
CS
- child source typeCD
- child destination type- Parameters:
source
- to map fromdestinationType
- to map to- Returns:
- new child MappingContext
- Throws:
IllegalArgumentException
- ifsource
ordestinatinoType
are null
-
create
<CS,CD> MappingContext<CS,CD> create(CS source, Type destinationType)
Creates a new child MappingContext for thesource
anddestinationType
which inherits all other information from the this MappingContext.- Type Parameters:
CS
- child source typeCD
- child destination type- Parameters:
source
- to map fromdestinationType
- to map to- Returns:
- new child MappingContext
- Throws:
IllegalArgumentException
- ifsource
ordestinatinoType
are null
-
getDestination
D getDestination()
Returns the destination object being mapped to or null if the destination has not yet been initialized.
-
getGenericDestinationType
Type getGenericDestinationType()
Returns the generic destination type.
-
getMapping
Mapping getMapping()
Returns the mapping associated with the mapping request elsenull
if the request did not originate from aTypeMap
.
-
getMappingEngine
MappingEngine getMappingEngine()
Returns the MappingEngine that initiated the mapping request.
-
getParent
MappingContext<?,?> getParent()
Returns the parent MappingContext from which the current MappingContext was created, elsenull
if there is no parent context.
-
getSource
S getSource()
Returns the source object being mapped from.
-
getTypeMap
TypeMap<S,D> getTypeMap()
Returns the TypeMap associated with the mapping request elsenull
if the request did not originate from a TypeMap.
-
getTypeMapName
String getTypeMapName()
Returns the name of the TypeMap associated with the mapping request elsenull
if the request did not originate from a named TypeMap.
-
-