Interface ClassMappingMetadata
-
- All Known Implementing Classes:
DozerClassMappingMetadata
public interface ClassMappingMetadataThis interface provides read-only access to all important aspects of the mapping metadata that specifies how two classes are mapped to one another. The interface also holds methods to query the individual field mappings that are part of the class mapping definition. This covers custom field mappings as well as implicit field mappings automatically introduced by the dozer framework.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetDateFormat()Obtains the date format that is used during date conversions.Class<?>getDestinationClass()Obtains the Class object that represents the destination class in the mapping definition.StringgetDestinationClassName()Obtains the name of the destination class in the mapping definition.FieldMappingMetadatagetFieldMappingByDestination(String destinationFieldName)Gets a single field mapping definition by looking up the name of the destination field.FieldMappingMetadatagetFieldMappingBySource(String sourceFieldName)Gets a single field mapping definition by looking up the name of the source field.List<FieldMappingMetadata>getFieldMappings()Gets a list of all field mapping definitions that are used for the mapping of the classes.StringgetMapId()Returns the map id of this mapping definition used for contextual mapping selection.MappingDirectiongetMappingDirection()Used to check if a mapping is bi- or unidirectional.Class<?>getSourceClass()Obtains the Class object that represents the source class in the mapping definition.StringgetSourceClassName()Obtains the name of the source class in the mapping definition.booleanisDestinationMapEmptyString()Whether destination should map empty stringsbooleanisDestinationMapNull()Whether destination should map nullbooleanisSourceMapEmptyString()Whether source should map empty stringsbooleanisSourceMapNull()Whether source should map nullbooleanisStopOnErrors()Whether to stop if an exception occurs while mappingbooleanisTrimStrings()Whether strings should be trimmedbooleanisWildcard()Whether wildcard policy is enabled
-
-
-
Method Detail
-
getSourceClassName
String getSourceClassName()
Obtains the name of the source class in the mapping definition.- Returns:
- The name of the source class.
-
getDestinationClassName
String getDestinationClassName()
Obtains the name of the destination class in the mapping definition.- Returns:
- The name of the destination class.
-
getSourceClass
Class<?> getSourceClass()
Obtains the Class object that represents the source class in the mapping definition.- Returns:
- The Class object of the source class.
-
getDestinationClass
Class<?> getDestinationClass()
Obtains the Class object that represents the destination class in the mapping definition.- Returns:
- The Class object of the destination class.
-
isStopOnErrors
boolean isStopOnErrors()
Whether to stop if an exception occurs while mapping- Returns:
- true if the mapping will be stopped upon errors.
-
isTrimStrings
boolean isTrimStrings()
Whether strings should be trimmed- Returns:
- true if strings are trimmed during mapping.
-
isWildcard
boolean isWildcard()
Whether wildcard policy is enabled- Returns:
- The wildcard policy. True means that fields with the same name are automatically mapped.
-
isSourceMapNull
boolean isSourceMapNull()
Whether source should map null- Returns:
- true if null values are mapped from the source class.
-
isDestinationMapNull
boolean isDestinationMapNull()
Whether destination should map null- Returns:
- true if null values are mapped from the destination class.
-
isSourceMapEmptyString
boolean isSourceMapEmptyString()
Whether source should map empty strings- Returns:
- true if empty are mapped from the source class.
-
isDestinationMapEmptyString
boolean isDestinationMapEmptyString()
Whether destination should map empty strings- Returns:
- true if empty are mapped from the destination class.
-
getDateFormat
String getDateFormat()
Obtains the date format that is used during date conversions.- Returns:
- The date format as a string.
-
getMappingDirection
MappingDirection getMappingDirection()
Used to check if a mapping is bi- or unidirectional.- Returns:
- The
MappingDirectionobject that specifies the direction of the map.
-
getMapId
String getMapId()
Returns the map id of this mapping definition used for contextual mapping selection.- Returns:
- The identifier as a string.
-
getFieldMappings
List<FieldMappingMetadata> getFieldMappings()
Gets a list of all field mapping definitions that are used for the mapping of the classes.- Returns:
- The list of
FieldMappingMetadataobjects.
-
getFieldMappingBySource
FieldMappingMetadata getFieldMappingBySource(String sourceFieldName)
Gets a single field mapping definition by looking up the name of the source field.- Parameters:
sourceFieldName- The name of the source field.- Returns:
- A
FieldMappingMetadataobject. - Throws:
MetadataLookupException- If no field map could be found.
-
getFieldMappingByDestination
FieldMappingMetadata getFieldMappingByDestination(String destinationFieldName)
Gets a single field mapping definition by looking up the name of the destination field.- Parameters:
destinationFieldName- The name of the destination field.- Returns:
- A
FieldMappingMetadataobject. - Throws:
MetadataLookupException- If no field map could be found.
-
-