|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
S
- source typeD
- destination typepublic interface TypeMap<S,D>
Encapsulates mapping configuration for a source and destination type pair.
Method Summary | |
---|---|
void |
addMappings(PropertyMap<S,D> propertyMap)
Loads mappings from the propertyMap into the TypeMap. |
Condition<?,?> |
getCondition()
Returns the Condition that must apply in order for mapping to take place, else null if
no condition has been configured. |
Converter<S,D> |
getConverter()
Returns the Converter configured for this TypeMap, else null if no Converter has been
configured. |
Class<D> |
getDestinationType()
Returns the destination type for the TypeMap. |
List<Mapping> |
getMappings()
Returns a snapshot of the TypeMap's mappings. |
Provider<D> |
getProvider()
Returns the Provider configured for this TypeMap, else null if no Provider has been
configured. |
Class<S> |
getSourceType()
Returns the source type for the TypeMap. |
List<PropertyInfo> |
getUnmappedProperties()
Returns a snapshot list of destination properties that do not have mappings defined, else empty list if all destination properties are mapped. |
D |
map(S source)
Maps source to an instance of type D . |
void |
map(S source,
D destination)
Maps source to destination . |
TypeMap<S,D> |
setCondition(Condition<?,?> condition)
Sets the condition that must apply in order for mapping to take place. |
TypeMap<S,D> |
setConverter(Converter<S,D> converter)
Sets the converter to be used for any conversion requests for the TypeMap's source to
destination type. |
TypeMap<S,D> |
setProvider(Provider<D> provider)
Sets the provider to be used for providing instances of destination type D
during mapping. |
void |
validate()
Validates that every top level destination property is mapped to one and only one source property, or that a Converter was set . |
Method Detail |
---|
void addMappings(PropertyMap<S,D> propertyMap)
propertyMap
into the TypeMap. Mappings defined in the
propertyMap
will override any implicit mappings for the same properties.
propertyMap
- from which mappings should be loaded
IllegalArgumentException
- if propertyMap
is null
ConfigurationException
- if a configuration error occurs while adding mappings for the
propertyMap
Condition<?,?> getCondition()
null
if
no condition has been configured.
setCondition(Condition)
Converter<S,D> getConverter()
null
if no Converter has been
configured.
setConverter(Converter)
Class<D> getDestinationType()
List<Mapping> getMappings()
This method is part of the ModelMapper SPI.
Provider<D> getProvider()
null
if no Provider has been
configured.
setProvider(Provider)
Class<S> getSourceType()
List<PropertyInfo> getUnmappedProperties()
This method is part of the ModelMapper SPI.
D map(S source)
source
to an instance of type D
.
source
- object to map from
D
IllegalArgumentException
- if source
is null
MappingException
- if an error occurs while mappingvoid map(S source, D destination)
source
to destination
.
source
- object to map fromdestination
- object to map to
IllegalArgumentException
- if source
or destination
are null
MappingException
- if an error occurs while mappingTypeMap<S,D> setCondition(Condition<?,?> condition)
condition
that must apply in order for mapping to take place.
IllegalArgumentException
- if condition
is nullTypeMap<S,D> setConverter(Converter<S,D> converter)
converter
to be used for any conversion requests for the TypeMap's source to
destination type.
IllegalArgumentException
- if converter
is nullTypeMap<S,D> setProvider(Provider<D> provider)
provider
to be used for providing instances of destination type D
during mapping.
IllegalArgumentException
- if provider
is nullvoid validate()
Converter
was set
. If not, a
ConfigurationException is thrown detailing any missing mappings.
ValidationException
- if any TypeMaps contain unmapped properties
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |