| java.lang.Object org.springframework.binding.mapping.MappingBuilder
MappingBuilder | public class MappingBuilder (Code) | | A stateful builder that builds
Mapping objects. Designed for
convenience to build mappings in a clear, readable manner.
Example usage:
MappingBuilder mapping = new MappingBuilder();
Mapping result = mapping.source("foo").target("bar").from(String.class).to(Long.class).value();
Calling the
MappingBuilder.value() result method clears out this builder's state so
it can be reused to build another mapping.
author: Keith Donald author: Erwin Vervaet |
Constructor Summary | |
public | MappingBuilder(ExpressionParser expressionParser) Creates a mapping builder that uses the expression parser to parse
attribute mapping expressions. |
MappingBuilder | public MappingBuilder(ExpressionParser expressionParser)(Code) | | Creates a mapping builder that uses the expression parser to parse
attribute mapping expressions.
Parameters: expressionParser - the expression parser |
from | public MappingBuilder from(Class sourceType)(Code) | | Sets the expected type of the object returned by evaluating the source
expression. Used in conjunction with
MappingBuilder.to(Class) to perform a type
conversion during the mapping process.
Parameters: sourceType - the source type this, to support call-chaining |
required | public MappingBuilder required()(Code) | | Marks the mapping to be built a "required" mapping.
this, to support call-chaining |
reset | public void reset()(Code) | | Reset this mapping builder.
|
setConversionService | public void setConversionService(ConversionService conversionService)(Code) | | Sets the conversion service that will convert the object returned by
evaluating the source expression to the
MappingBuilder.to(Class) type if
necessary.
Parameters: conversionService - the conversion service |
source | public MappingBuilder source(String expressionString)(Code) | | Sets the source expression of the mapping built by this builder.
Parameters: expressionString - the expression string this, to support call-chaining |
target | public MappingBuilder target(String expressionString)(Code) | | Sets the target property expression of the mapping built by this builder.
Parameters: expressionString - the expression string this, to support call-chaining |
targetCollection | public MappingBuilder targetCollection(String expressionString)(Code) | | Sets the target collection of the mapping built by this builder.
Parameters: expressionString - the expression string, resolving a collection this, to support call-chaining |
to | public MappingBuilder to(Class targetType)(Code) | | Sets the target type of the property writeable by the target expression.
Parameters: targetType - the target type this, to support call-chaining |
value | public Mapping value()(Code) | | The logical GoF builder getResult method, returning a fully constructed
Mapping from the configured pieces. Once called, the state of this
builder is nulled out to support building a new mapping object again.
the mapping result |
|
|