org.modelmapper.config
Interface Configuration

All Known Implementing Classes:
InheritingConfiguration

public interface Configuration

Configures conventions used during the matching process.

Author:
Jonathan Halterman

Nested Class Summary
static class Configuration.AccessLevel
          The level at and below which properties can be accessed.
 
Method Summary
 Configuration addConverter(ConditionalConverter<?,?> converter)
          Registers the conditional converter.
 Configuration copy()
          Returns a copy of the Configuration.
 Configuration enableFieldMatching(boolean enabled)
          Sets whether field matching should be enabled.
 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.
 Provider<?> getProvider()
          Returns the Provider used for provisioning destination object instances.
 NameTokenizer getSourceNameTokenizer()
          Returns the source name tokenizer.
 NameTransformer getSourceNameTransformer()
          Returns the source name transformer.
 NamingConvention getSourceNamingConvention()
          Gets the source naming convention.
 Configuration ignoreAmbiguity(boolean ignore)
          Sets whether destination properties that match more than one source property should be ignored.
 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.
 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 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 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.
 

Method Detail

addConverter

Configuration addConverter(ConditionalConverter<?,?> converter)
Registers the conditional converter. The converter will be first in list of converters used to fulfill mapping requests.

This method is part of the ModelMapper SPI.

Parameters:
converter - to register
Throws:
IllegalArgumentException - if converter is null

copy

Configuration copy()
Returns a copy of the Configuration.


enableFieldMatching

Configuration enableFieldMatching(boolean enabled)
Sets whether field matching should be enabled. When true, mapping may take place between accessible fields. Default is false.

Parameters:
enabled - whether field matching is enabled
See Also:
isFieldMatchingEnabled(), setFieldAccessLevel(AccessLevel)

getDestinationNameTokenizer

NameTokenizer getDestinationNameTokenizer()
Returns the destination name tokenizer.

See Also:
setDestinationNameTokenizer(NameTokenizer)

getDestinationNameTransformer

NameTransformer getDestinationNameTransformer()
Returns the destination name transformer.

See Also:
setDestinationNameTransformer(NameTransformer)

getDestinationNamingConvention

NamingConvention getDestinationNamingConvention()
Returns the destination naming convention.

See Also:
setDestinationNamingConvention(NamingConvention)

getFieldAccessLevel

Configuration.AccessLevel getFieldAccessLevel()
Returns the field access level.

See Also:
setFieldAccessLevel(AccessLevel)

getMatchingStrategy

MatchingStrategy getMatchingStrategy()
Gets the matching strategy.

See Also:
setMatchingStrategy(MatchingStrategy)

getMethodAccessLevel

Configuration.AccessLevel getMethodAccessLevel()
Returns the method access level.

See Also:
setMethodAccessLevel(AccessLevel)

getProvider

Provider<?> getProvider()
Returns the Provider used for provisioning destination object instances.

See Also:
setProvider(Provider)

getSourceNameTokenizer

NameTokenizer getSourceNameTokenizer()
Returns the source name tokenizer.

See Also:
setSourceNameTokenizer(NameTokenizer)

getSourceNameTransformer

NameTransformer getSourceNameTransformer()
Returns the source name transformer.

See Also:
setSourceNameTransformer(NameTransformer)

getSourceNamingConvention

NamingConvention getSourceNamingConvention()
Gets the source naming convention.

See Also:
setSourceNamingConvention(NamingConvention)

ignoreAmbiguity

Configuration ignoreAmbiguity(boolean ignore)
Sets whether destination properties that match more than one source property should be ignored. When true ambiguous destination properties are skipped during the matching process. When false a ConfigurationException is thrown when ambiguous properties are encountered.

Parameters:
ignore - whether ambiguity is to be ignored
See Also:
isAmbiguityIgnored()

isAmbiguityIgnored

boolean isAmbiguityIgnored()
Returns true if ambiguous properties are ignored or false if they will result in an exception.

See Also:
ignoreAmbiguity(boolean)

isFieldMatchingEnabled

boolean isFieldMatchingEnabled()
Returns whether field matching is enabled.

See Also:
enableFieldMatching(boolean)

setDestinationNameTokenizer

Configuration setDestinationNameTokenizer(NameTokenizer nameTokenizer)
Sets the tokenizer to be applied to destination property and class names during the matching process.

Throws:
IllegalArgumentException - if nameTokenizer is null

setDestinationNameTransformer

Configuration setDestinationNameTransformer(NameTransformer nameTransformer)
Sets the name transformer used to transform destination property and class names during the matching process.

Throws:
IllegalArgumentException - if nameTransformer is null

setDestinationNamingConvention

Configuration setDestinationNamingConvention(NamingConvention namingConvention)
Sets the convention used to identify destination property names during the matching process.

Throws:
IllegalArgumentException - if namingConvention is null

setFieldAccessLevel

Configuration setFieldAccessLevel(Configuration.AccessLevel accessLevel)
Indicates that fields should be eligible for matching at the given accessLevel.

Note: Field access is only used when field matching is enabled.

Throws:
IllegalArgumentException - if accessLevel is null
See Also:
Configuration.AccessLevel, enableFieldMatching(boolean)

setMatchingStrategy

Configuration setMatchingStrategy(MatchingStrategy matchingStrategy)
Sets the strategy used to match source properties to destination properties.

Throws:
IllegalArgumentException - if matchingStrategy is null

setMethodAccessLevel

Configuration setMethodAccessLevel(Configuration.AccessLevel accessLevel)
Indicates that methods should be eligible for matching at the given accessLevel.

Throws:
IllegalArgumentException - if accessLevel is null
See Also:
Configuration.AccessLevel

setProvider

Configuration setProvider(Provider<?> provider)
Sets the provider to use for providing destination object instances.

Parameters:
provider - to register
Throws:
IllegalArgumentException - if provider is null

setSourceNameTokenizer

Configuration setSourceNameTokenizer(NameTokenizer nameTokenizer)
Sets the tokenizer to be applied to source property and class names during the matching process.

Throws:
IllegalArgumentException - if nameTokenizer is null

setSourceNameTransformer

Configuration setSourceNameTransformer(NameTransformer nameTransformer)
Sets the name transformer used to transform source property and class names during the matching process.

Throws:
IllegalArgumentException - if nameTransformer is null

setSourceNamingConvention

Configuration setSourceNamingConvention(NamingConvention namingConvention)
Sets the convention used to identify source property names during the matching process.

Throws:
IllegalArgumentException - if namingConvention is null


Copyright © 2011. All Rights Reserved.