Class DefaultMapping

java.lang.Object
org.springframework.binding.mapping.impl.DefaultMapping
All Implemented Interfaces:
Mapping

public class DefaultMapping extends Object implements Mapping
A single mapping definition, encapsulating the information necessary to map the result of evaluating an expression on a source object to a property on a target object, optionally applying a type conversion during the mapping process.
Author:
Keith Donald, Scott Andrews
  • Constructor Details

    • DefaultMapping

      public DefaultMapping(Expression sourceExpression, Expression targetExpression)
      Creates a new mapping.
      Parameters:
      sourceExpression - the source expression
      targetExpression - the target expression
  • Method Details

    • getSourceExpression

      public Expression getSourceExpression()
      Description copied from interface: Mapping
      The source of the mapping.
      Specified by:
      getSourceExpression in interface Mapping
    • getTargetExpression

      public Expression getTargetExpression()
      Description copied from interface: Mapping
      The target of the mapping.
      Specified by:
      getTargetExpression in interface Mapping
    • isRequired

      public boolean isRequired()
      Description copied from interface: Mapping
      Whether this is a required mapping.
      Specified by:
      isRequired in interface Mapping
    • getTypeConverter

      public ConversionExecutor getTypeConverter()
      Returns the type conversion executor to use during mapping execution. May be null.
    • setTypeConverter

      public void setTypeConverter(ConversionExecutor typeConverter)
      Sets a specific type conversion executor to use during mapping execution.
      Parameters:
      typeConverter - the type converter
    • setRequired

      public void setRequired(boolean required)
      Indicates if this mapping is a required mapping. Default is false.
      Parameters:
      required - required status
    • map

      public void map(DefaultMappingContext context)
      Execute this mapping.
      Parameters:
      context - the mapping context
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object