Class DefaultMappingContext
java.lang.Object
org.springframework.binding.mapping.impl.DefaultMappingContext
Default mapping context implementation.
- Author:
- Keith Donald, Scott Andrews
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the current mapping.Returns the mapping results recorded in this context.The object being mapped from.The object being mapped to.void
setCurrentMapping
(Mapping mapping) Sets the current mapping.void
setRequiredErrorResult
(Object originalValue) Indicates the current mapping ended with a 'required' error.void
Indicates a error occurred accessing the source mapping expression.void
setSuccessResult
(Object originalValue, Object mappedValue) Indicates the current mapping completed successfully.void
setTargetAccessError
(Object originalValue, EvaluationException error) Indicates a error occurred accessing the target mapping expression.void
setTypeConversionErrorResult
(Object originalValue, Exception cause) Indicates the current mapping ended with a 'type conversion' error.
-
Constructor Details
-
DefaultMappingContext
-
-
Method Details
-
getSource
The object being mapped from. -
getTarget
The object being mapped to. -
getCurrentMapping
Returns the current mapping.- Returns:
- the current mapping
-
setCurrentMapping
Sets the current mapping. Called when a single mapping operation is about to begin. This updates progress of the overall mapping transaction.- Parameters:
mapping
- the mapping to make the current mapping
-
setSuccessResult
Indicates the current mapping completed successfully.- Parameters:
originalValue
- the original value from the source of the mappingmappedValue
- the successfully mapped value, which may be different from the original if a type conversion was performed
-
setRequiredErrorResult
Indicates the current mapping ended with a 'required' error. This means the value obtained from the source was empty, and the mapping could not be completed as a result.- Parameters:
originalValue
- the original source value that is empty (null or an empty string, typically)
-
setTypeConversionErrorResult
Indicates the current mapping ended with a 'type conversion' error. This means the value obtained from the source could not be converted to a type that could be assigned to the target expression.- Parameters:
originalValue
- the original source value that is empty (null or an empty string, typically)cause
- the actual type conversion exception that occurred
-
setSourceAccessError
Indicates a error occurred accessing the source mapping expression.- Parameters:
error
- the error that occurred
-
setTargetAccessError
Indicates a error occurred accessing the target mapping expression.- Parameters:
error
- the error that occurred
-
getMappingResults
Returns the mapping results recorded in this context.- Returns:
- the mapping results
-