S
- source typeD
- destination typepublic interface TypeMap<S,D>
Modifier and Type | Method and Description |
---|---|
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.
|
Condition<?,?> |
getPropertyCondition()
Returns the Condition that must apply in properties in this TypeMap to be mapped, else
null if no condition has been configured. |
Converter<?,?> |
getPropertyConverter()
Returns the Converter used for converting properties in the TypeMap, else
null if no
Converter has been configured. |
Provider<?> |
getPropertyProvider()
Returns the Provider configured for this TypeMap, else
null if no Provider has been
configured. |
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> |
setPropertyCondition(Condition<?,?> condition)
Sets the
condition that must apply in order for properties in this TypeMap to be
mapped. |
TypeMap<S,D> |
setPropertyConverter(Converter<?,?> converter)
Sets the
converter to be used for converting properties in the TypeMap. |
TypeMap<S,D> |
setPropertyProvider(Provider<?> provider)
Sets the
provider to be used for providing instances of properties during mapping. |
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 . |
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 loadedIllegalArgumentException
- if propertyMap
is nullConfigurationException
- 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)
List<Mapping> getMappings()
This method is part of the ModelMapper SPI.
Condition<?,?> getPropertyCondition()
null
if no condition has been configured.setCondition(Condition)
Converter<?,?> getPropertyConverter()
null
if no
Converter has been configured.setPropertyConverter(Converter)
Provider<?> getPropertyProvider()
null
if no Provider has been
configured.setPropertyProvider(Provider)
Provider<D> getProvider()
null
if no Provider has been
configured.setProvider(Provider)
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 fromD
IllegalArgumentException
- if source
is nullMappingException
- if an error occurs while mappingvoid map(S source, D destination)
source
to destination
.source
- object to map fromdestination
- object to map toIllegalArgumentException
- if source
or destination
are nullMappingException
- 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. A converter will take precedence over any mappings that have been added to
the TypeMap.IllegalArgumentException
- if converter
is nullTypeMap<S,D> setPropertyCondition(Condition<?,?> condition)
condition
that must apply in order for properties in this TypeMap to be
mapped. This is overridden by any conditions defined in a PropertyMap.IllegalArgumentException
- if condition
is nullTypeMap<S,D> setPropertyConverter(Converter<?,?> converter)
converter
to be used for converting properties in the TypeMap. This is
overridden by any converters defined in a PropertyMap.IllegalArgumentException
- if converter
is nullTypeMap<S,D> setPropertyProvider(Provider<?> provider)
provider
to be used for providing instances of properties during mapping. This
is overriden by any providers defined in a PropertyMap.IllegalArgumentException
- if provider
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 propertiesCopyright © 2011-2012. All Rights Reserved.