Source:
public PropertyMapping build() { String sourceErrorMessagePart = "constant '" + constantExpression + "'"; Type sourceType; if ( !isConstantDirectAssignable( targetType, constantExpression ) ) { sourceType = ctx.getTypeFactory().getType( String.class ); constantExpression = "\"" + constantExpression + "\""; } else { sourceType = targetType; } Assignment assignment = null; if ( !targetType.isEnumType() ) { assignment = ctx.getMappingResolver().getTargetAssignment( method, targetType, targetPropertyName, formattingParameters, selectionParameters, new SourceRHS( constantExpression, sourceType, existingVariableNames, sourceErrorMessagePart ), method.getMappingTargetParameter() != null ); } else { assignment = getEnumAssignment(); } if ( assignment != null ) { if ( Executables.isSetterMethod( targetWriteAccessor ) || Executables.isFieldAccessor( targetWriteAccessor ) ) { if ( assignment.isCallingUpdateMethod() ) { if ( targetReadAccessor == null ) { ctx.getMessager().printMessage( method.getExecutable(), Message.CONSTANTMAPPING_NO_READ_ACCESSOR_FOR_TARGET_TYPE, targetPropertyName ); } boolean mapNullToDefault = method.getMapperConfiguration(). getNullValueMappingStrategy() == NullValueMappingStrategyPrism.RETURN_DEFAULT; Assignment factoryMethod = ctx.getMappingResolver().getFactoryMethod( method, targetType, null ); assignment = new UpdateWrapper( assignment, method.getThrownTypes(), factoryMethod, isFieldAssignment(), targetType, false, mapNullToDefault ); } else { assignment = new SetterWrapper( assignment, method.getThrownTypes(), isFieldAssignment() ); } } else { assignment = new GetterWrapperForCollectionsAndMaps( assignment, method.getThrownTypes(), targetType, isFieldAssignment() ); } } else { ctx.getMessager().printMessage( method.getExecutable(), Message.CONSTANTMAPPING_MAPPING_NOT_FOUND, sourceType, constantExpression, targetType, targetPropertyName ); } return new PropertyMapping( targetPropertyName, targetWriteAccessor.getSimpleName().toString(), ValueProvider.of( targetReadAccessor ), targetType, assignment, dependsOn, null ); }

Target:
public PropertyMapping build() { String sourceErrorMessagePart = "constant '" + constantExpression + "'"; Type sourceType = ctx.getTypeFactory().getTypeForConstant( targetType, constantExpression ); if ( String.class.getCanonicalName().equals( sourceType.getFullyQualifiedName() ) ) { constantExpression = "\"" + constantExpression + "\""; } Assignment assignment = null; if ( !targetType.isEnumType() ) { assignment = ctx.getMappingResolver().getTargetAssignment( method, targetType, targetPropertyName, formattingParameters, selectionParameters, new SourceRHS( constantExpression, sourceType, existingVariableNames, sourceErrorMessagePart ), method.getMappingTargetParameter() != null ); } else { assignment = getEnumAssignment(); } if ( assignment != null ) { if ( Executables.isSetterMethod( targetWriteAccessor ) || Executables.isFieldAccessor( targetWriteAccessor ) ) { if ( assignment.isCallingUpdateMethod() ) { if ( targetReadAccessor == null ) { ctx.getMessager().printMessage( method.getExecutable(), Message.CONSTANTMAPPING_NO_READ_ACCESSOR_FOR_TARGET_TYPE, targetPropertyName ); } boolean mapNullToDefault = method.getMapperConfiguration(). getNullValueMappingStrategy() == NullValueMappingStrategyPrism.RETURN_DEFAULT; Assignment factoryMethod = ctx.getMappingResolver().getFactoryMethod( method, targetType, null ); assignment = new UpdateWrapper( assignment, method.getThrownTypes(), factoryMethod, isFieldAssignment(), targetType, false, mapNullToDefault ); } else { assignment = new SetterWrapper( assignment, method.getThrownTypes(), isFieldAssignment() ); } } else { assignment = new GetterWrapperForCollectionsAndMaps( assignment, method.getThrownTypes(), targetType, isFieldAssignment() ); } } else { ctx.getMessager().printMessage( method.getExecutable(), mirror, Message.CONSTANTMAPPING_MAPPING_NOT_FOUND, sourceType, constantExpression, targetType, targetPropertyName ); } return new PropertyMapping( targetPropertyName, targetWriteAccessor.getSimpleName().toString(), ValueProvider.of( targetReadAccessor ), targetType, assignment, dependsOn, null ); }