Source:
public PropertyMapping build() { String sourceElement = getSourceElement(); Type sourceType = getSourceType(); String sourceRefStr; if ( targetWriteAccessorType == TargetWriteAccessorType.ADDER && sourceType.isCollectionType() ) { sourceType = sourceType.getTypeParameters().get( 0 ); sourceRefStr = Executables.getElementNameForAdder( targetWriteAccessor ); } else { sourceRefStr = getSourceRef(); } boolean preferUpdateMethods; if ( targetWriteAccessorType == TargetWriteAccessorType.ADDER ) { preferUpdateMethods = false; } else { preferUpdateMethods = method.getMappingTargetParameter() != null; } Assignment assignment = ctx.getMappingResolver().getTargetAssignment( method, sourceElement, sourceType, targetType, targetPropertyName, formattingParameters, selectionParameters, sourceRefStr, preferUpdateMethods ); if ( assignment == null ) { if ( (sourceType.isCollectionType() || sourceType.isArrayType()) && (targetType.isIterableType()) ) { assignment = forgeIterableMapping( sourceType, targetType, sourceRefStr, method.getExecutable() ); } else if ( sourceType.isMapType() && targetType.isMapType() ) { assignment = forgeMapMapping( sourceType, targetType, sourceRefStr, method.getExecutable() ); } } if ( assignment != null ) { if ( targetType.isCollectionOrMapType() ) { assignment = assignToCollection( targetType, targetWriteAccessorType, assignment ); } else if ( targetType.isArrayType() && sourceType.isArrayType() && assignment.getType() == DIRECT ) { assignment = assignToArray( targetType, assignment ); } else { assignment = assignToPlain( sourceType, targetType, targetWriteAccessorType, assignment ); } } else { ctx.getMessager().printMessage( method.getExecutable(), Message.PROPERTYMAPPING_MAPPING_NOT_FOUND, sourceElement, targetType, targetPropertyName, targetType, getSourceType() ); } return new PropertyMapping( targetPropertyName, sourceReference.getParameter().getName(), targetWriteAccessor.getSimpleName().toString(), targetReadAccessor != null ? targetReadAccessor.getSimpleName().toString() : null, targetType, localTargetVarName, assignment, dependsOn, getDefaultValueAssignment() ); }

Target:
public PropertyMapping build() { String sourceElement = getSourceElement(); Type sourceType = getSourceType(); String sourceRefStr; if ( targetWriteAccessorType == TargetWriteAccessorType.ADDER && sourceType.isCollectionType() ) { sourceType = sourceType.getTypeParameters().get( 0 ); sourceRefStr = Executables.getElementNameForAdder( targetWriteAccessor ); } else { sourceRefStr = getSourceRef(); } boolean preferUpdateMethods; if ( targetWriteAccessorType == TargetWriteAccessorType.ADDER ) { preferUpdateMethods = false; } else { preferUpdateMethods = method.getMappingTargetParameter() != null; } Assignment assignment = ctx.getMappingResolver().getTargetAssignment( method, sourceElement, sourceType, targetType, targetPropertyName, formattingParameters, selectionParameters, sourceRefStr, preferUpdateMethods ); if ( assignment == null ) { if ( (sourceType.isCollectionType() || sourceType.isArrayType()) && targetType.isIterableType() ) { assignment = forgeIterableMapping( sourceType, targetType, sourceRefStr, method.getExecutable() ); } else if ( sourceType.isMapType() && targetType.isMapType() ) { assignment = forgeMapMapping( sourceType, targetType, sourceRefStr, method.getExecutable() ); } } if ( assignment != null ) { if ( targetType.isCollectionOrMapType() ) { assignment = assignToCollection( targetType, targetWriteAccessorType, assignment ); } else if ( targetType.isArrayType() && sourceType.isArrayType() && assignment.getType() == DIRECT ) { assignment = assignToArray( targetType, assignment ); } else { assignment = assignToPlain( sourceType, targetType, targetWriteAccessorType, assignment ); } } else { ctx.getMessager().printMessage( method.getExecutable(), Message.PROPERTYMAPPING_MAPPING_NOT_FOUND, sourceElement, targetType, targetPropertyName, targetType, getSourceType() ); } return new PropertyMapping( targetPropertyName, sourceReference.getParameter().getName(), targetWriteAccessor.getSimpleName().toString(), targetReadAccessor != null ? targetReadAccessor.getSimpleName().toString() : null, targetType, localTargetVarName, assignment, dependsOn, getDefaultValueAssignment() ); }