public interface Configuration
Modifier and Type | Interface and Description |
---|---|
static class |
Configuration.AccessLevel
The level at and below which properties can be accessed.
|
Modifier and Type | Method and Description |
---|---|
<T> Configuration |
addValueReader(ValueReader<T> valueReader)
Registers the
valueReader to use when mapping from instances of types T . |
Configuration |
copy()
Returns a copy of the Configuration.
|
List<ConditionalConverter<?,?>> |
getConverters()
Gets the ordered list of internal conditional converters that are used to perform type
conversion.
|
NameTokenizer |
getDestinationNameTokenizer()
Returns the destination name tokenizer.
|
NameTransformer |
getDestinationNameTransformer()
Returns the destination name transformer.
|
NamingConvention |
getDestinationNamingConvention()
Returns the destination naming convention.
|
Configuration.AccessLevel |
getFieldAccessLevel()
Returns the field access level.
|
MatchingStrategy |
getMatchingStrategy()
Gets the matching strategy.
|
Configuration.AccessLevel |
getMethodAccessLevel()
Returns the method access level.
|
Condition<?,?> |
getPropertyCondition()
Returns the Condition that must apply for a property in order for mapping to take place, else
null if no condition has been configured. |
Provider<?> |
getProvider()
Returns the Provider used for provisioning destination object instances, else
null if
no Provider has been configured. |
NameTokenizer |
getSourceNameTokenizer()
Returns the source name tokenizer.
|
NameTransformer |
getSourceNameTransformer()
Returns the source name transformer.
|
NamingConvention |
getSourceNamingConvention()
Gets the source naming convention.
|
List<ValueReader<?>> |
getValueReaders()
Gets a thread-safe, mutable, ordered list of internal and user-defined ValueReaders that are
used to read source object values during mapping.
|
boolean |
isAmbiguityIgnored()
Returns
true if ambiguous properties are ignored or false if they will result
in an exception. |
boolean |
isFieldMatchingEnabled()
Returns whether field matching is enabled.
|
boolean |
isFullTypeMatchingRequired()
|
boolean |
isImplicitMappingEnabled()
Returns whether implicit mapping should be enabled.
|
Configuration |
setAmbiguityIgnored(boolean ignore)
Sets whether destination properties that match more than one source property should be ignored.
|
Configuration |
setDestinationNameTokenizer(NameTokenizer nameTokenizer)
Sets the tokenizer to be applied to destination property and class names during the matching
process.
|
Configuration |
setDestinationNameTransformer(NameTransformer nameTransformer)
Sets the name transformer used to transform destination property and class names during the
matching process.
|
Configuration |
setDestinationNamingConvention(NamingConvention namingConvention)
Sets the convention used to identify destination property names during the matching process.
|
Configuration |
setFieldAccessLevel(Configuration.AccessLevel accessLevel)
Indicates that fields should be eligible for matching at the given
accessLevel . |
Configuration |
setFieldMatchingEnabled(boolean enabled)
Sets whether field matching should be enabled.
|
Configuration |
setFullTypeMatchingRequired(boolean required)
Set whether
ConditionalConverter s must define a full match in
order to be applied. |
Configuration |
setImplicitMappingEnabled(boolean enabled)
Sets whether implicit mapping should be enabled.
|
Configuration |
setMatchingStrategy(MatchingStrategy matchingStrategy)
Sets the strategy used to match source properties to destination properties.
|
Configuration |
setMethodAccessLevel(Configuration.AccessLevel accessLevel)
Indicates that methods should be eligible for matching at the given
accessLevel . |
Configuration |
setPropertyCondition(Condition<?,?> condition)
Sets the
condition that must apply for a property in order for mapping to take place. |
Configuration |
setProvider(Provider<?> provider)
Sets the
provider to use for providing destination object instances. |
Configuration |
setSourceNameTokenizer(NameTokenizer nameTokenizer)
Sets the tokenizer to be applied to source property and class names during the matching
process.
|
Configuration |
setSourceNameTransformer(NameTransformer nameTransformer)
Sets the name transformer used to transform source property and class names during the matching
process.
|
Configuration |
setSourceNamingConvention(NamingConvention namingConvention)
Sets the convention used to identify source property names during the matching process.
|
<T> Configuration addValueReader(ValueReader<T> valueReader)
valueReader
to use when mapping from instances of types T
.
This method is part of the ModelMapper SPI.
T
- source typevalueReader
- to registerIllegalArgumentException
- if valueReader
is null or if type argument T
is not declared for the valueReader
Configuration copy()
List<ConditionalConverter<?,?>> getConverters()
This method is part of the ModelMapper SPI.
NameTokenizer getDestinationNameTokenizer()
NameTransformer getDestinationNameTransformer()
NamingConvention getDestinationNamingConvention()
Configuration.AccessLevel getFieldAccessLevel()
setFieldAccessLevel(AccessLevel)
MatchingStrategy getMatchingStrategy()
Configuration.AccessLevel getMethodAccessLevel()
setMethodAccessLevel(AccessLevel)
Condition<?,?> getPropertyCondition()
null
if no condition has been configured.setPropertyCondition(Condition)
Provider<?> getProvider()
null
if
no Provider has been configured.setProvider(Provider)
NameTokenizer getSourceNameTokenizer()
NameTransformer getSourceNameTransformer()
NamingConvention getSourceNamingConvention()
List<ValueReader<?>> getValueReaders()
The returned List throws an IllegalArgumentException when attempting to add or set a
ValueReader for which the type argument T
has not been defined.
This method is part of the ModelMapper SPI.
boolean isAmbiguityIgnored()
true
if ambiguous properties are ignored or false
if they will result
in an exception.setAmbiguityIgnored(boolean)
boolean isFieldMatchingEnabled()
setFieldMatchingEnabled(boolean)
boolean isFullTypeMatchingRequired()
true
if ConditionalConverter
s must define a full
match in order to be applied. Otherwise conditional converters may also be applied for a
partial
match.
Default is false
.
setFullTypeMatchingRequired(boolean)
boolean isImplicitMappingEnabled()
true
(default), ModelMapper
will implicitly map source to destination properties based on configured conventions. When
false
, only explicit mappings defined in property maps
will be
used.setImplicitMappingEnabled(boolean)
Configuration setAmbiguityIgnored(boolean ignore)
ignore
- whether ambiguity is to be ignoredisAmbiguityIgnored()
Configuration setDestinationNameTokenizer(NameTokenizer nameTokenizer)
IllegalArgumentException
- if nameTokenizer
is nullConfiguration setDestinationNameTransformer(NameTransformer nameTransformer)
IllegalArgumentException
- if nameTransformer
is nullConfiguration setDestinationNamingConvention(NamingConvention namingConvention)
IllegalArgumentException
- if namingConvention
is nullConfiguration setFieldAccessLevel(Configuration.AccessLevel accessLevel)
accessLevel
.
Note: Field access is only used when field
matching
is enabled.
IllegalArgumentException
- if accessLevel
is nullsetFieldMatchingEnabled(boolean)
Configuration setFieldMatchingEnabled(boolean enabled)
false
.enabled
- whether field matching is enabledisFieldMatchingEnabled()
,
setFieldAccessLevel(AccessLevel)
Configuration setFullTypeMatchingRequired(boolean required)
ConditionalConverter
s must define a full
match in
order to be applied. If false
, conditional converters may also be applied for a
partial
match.required
- whether full type matching is required for conditional converters.isFullTypeMatchingRequired()
Configuration setImplicitMappingEnabled(boolean enabled)
true
(default), ModelMapper will
implicitly map source to destination properties based on configured conventions. When
false
, only explicit mappings defined in property maps
will be
used.enabled
- whether implicit matching is enabledisImplicitMappingEnabled()
Configuration setMatchingStrategy(MatchingStrategy matchingStrategy)
IllegalArgumentException
- if matchingStrategy
is nullConfiguration setMethodAccessLevel(Configuration.AccessLevel accessLevel)
accessLevel
.IllegalArgumentException
- if accessLevel
is nullConfiguration.AccessLevel
Configuration setPropertyCondition(Condition<?,?> condition)
condition
that must apply for a property in order for mapping to take place.
This is overridden by any property conditions defined in a TypeMap or PropertyMap.IllegalArgumentException
- if condition
is nullConfiguration setProvider(Provider<?> provider)
provider
to use for providing destination object instances.provider
- to registerIllegalArgumentException
- if provider
is nullConfiguration setSourceNameTokenizer(NameTokenizer nameTokenizer)
IllegalArgumentException
- if nameTokenizer
is nullConfiguration setSourceNameTransformer(NameTransformer nameTransformer)
IllegalArgumentException
- if nameTransformer
is nullConfiguration setSourceNamingConvention(NamingConvention namingConvention)
IllegalArgumentException
- if namingConvention
is nullCopyright © 2011–2014. All rights reserved.