ma.glasnost.orika.impl.generator
Interface Specification

All Known Implementing Classes:
AbstractSpecification, AnyTypeToString, ApplyRegisteredMapper, ArrayOrCollectionToArray, ArrayOrCollectionToCollection, ArrayOrCollectionToMap, Convert, CopyByReference, EnumToEnum, MapToArray, MapToCollection, MapToMap, MultiOccurrenceElementToObject, ObjectToMultiOccurrenceElement, ObjectToObject, PrimitiveAndObject, StringToEnum, StringToStringConvertible, UnmappableEnum

public interface Specification

Specification encapsulates the logic to generate code for mapping and comparing a pair of types

Author:
mattdeboer

Method Summary
 boolean appliesTo(FieldMap fieldMap)
          Tests whether this Specification applies to the specified MappedTypePair
 String generateEqualityTestCode(FieldMap fieldMap, VariableRef source, VariableRef destination, SourceCodeContext code)
          Generates code for a boolean equality test between the two variable types, where are potentially unrelated.
 String generateMappingCode(FieldMap fieldMap, VariableRef source, VariableRef destination, SourceCodeContext code)
          Generates code to map the provided field map
 void setMapperFactory(MapperFactory mapperFactory)
           
 

Method Detail

setMapperFactory

void setMapperFactory(MapperFactory mapperFactory)

appliesTo

boolean appliesTo(FieldMap fieldMap)
Tests whether this Specification applies to the specified MappedTypePair

Parameters:
fieldMap -
typePair -
Returns:
true if this specification applies to the given MappedTypePair

generateEqualityTestCode

String generateEqualityTestCode(FieldMap fieldMap,
                                VariableRef source,
                                VariableRef destination,
                                SourceCodeContext code)
Generates code for a boolean equality test between the two variable types, where are potentially unrelated.

Parameters:
source -
destination -
inverseProperty -
code -
Returns:
the code snippet which represents a true|false statement describing whether the two types should be considered 'equal'

generateMappingCode

String generateMappingCode(FieldMap fieldMap,
                           VariableRef source,
                           VariableRef destination,
                           SourceCodeContext code)
Generates code to map the provided field map

Parameters:
fieldMap - the fieldMap for which source code should be generated
source - a convenience wrapper around the source field which can be used facilitate code generation
destination - a convenience wrapper around the destination field which can be used facilitate code generation
inverseProperty -
code -
Returns:
the code snippet which represents mapping from the source to destination property


Copyright © 2013 Glasnost. All Rights Reserved.