Spring Web Flow

org.springframework.binding.mapping.impl
Class DefaultMappingContext

java.lang.Object
  extended by org.springframework.binding.mapping.impl.DefaultMappingContext

public class DefaultMappingContext
extends java.lang.Object

Default mapping context implementation.

Author:
Keith Donald, Scott Andrews

Constructor Summary
DefaultMappingContext(java.lang.Object source, java.lang.Object target)
           
 
Method Summary
 Mapping getCurrentMapping()
          Returns the current mapping.
 MappingResults getMappingResults()
          Returns the mapping results recorded in this context.
 java.lang.Object getSource()
          The object being mapped from.
 java.lang.Object getTarget()
          The object being mapped to.
 void setCurrentMapping(Mapping mapping)
          Sets the current mapping.
 void setRequiredErrorResult(java.lang.Object originalValue)
          Indicates the current mapping ended with a 'required' error.
 void setSourceAccessError(EvaluationException error)
          Indicates a error occurred accessing the source mapping expression.
 void setSuccessResult(java.lang.Object originalValue, java.lang.Object mappedValue)
          Indicates the current mapping completed successfully.
 void setTargetAccessError(java.lang.Object originalValue, EvaluationException error)
          Indicates a error occurred accessing the target mapping expression.
 void setTypeConversionErrorResult(java.lang.Object originalValue, java.lang.Exception cause)
          Indicates the current mapping ended with a 'type conversion' error.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMappingContext

public DefaultMappingContext(java.lang.Object source,
                             java.lang.Object target)
Method Detail

getSource

public java.lang.Object getSource()
The object being mapped from.


getTarget

public java.lang.Object getTarget()
The object being mapped to.


getCurrentMapping

public Mapping getCurrentMapping()
Returns the current mapping.

Returns:
the current mapping

setCurrentMapping

public void setCurrentMapping(Mapping mapping)
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

public void setSuccessResult(java.lang.Object originalValue,
                             java.lang.Object mappedValue)
Indicates the current mapping completed successfully.

Parameters:
originalValue - the original value from the source of the mapping
mappedValue - the successfully mapped value, which may be different from the original if a type conversion was performed

setRequiredErrorResult

public void setRequiredErrorResult(java.lang.Object originalValue)
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

public void setTypeConversionErrorResult(java.lang.Object originalValue,
                                         java.lang.Exception cause)
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

public void setSourceAccessError(EvaluationException error)
Indicates a error occurred accessing the source mapping expression.

Parameters:
error - the error that occurred

setTargetAccessError

public void setTargetAccessError(java.lang.Object originalValue,
                                 EvaluationException error)
Indicates a error occurred accessing the target mapping expression.

Parameters:
error - the error that occurred

getMappingResults

public MappingResults getMappingResults()
Returns the mapping results recorded in this context.

Returns:
the mapping results

Spring Web Flow