Class TargetReference.Builder
- java.lang.Object
-
- org.mapstruct.ap.internal.model.beanmapping.TargetReference.Builder
-
- Enclosing class:
- TargetReference
public static class TargetReference.Builder extends java.lang.ObjectBuilds aTargetReferencefrom an@Mappping.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.lang.model.element.AnnotationMirrorannotationMirrorprivate MappingOptionsmappingprivate FormattingMessagermessagerprivate Methodmethodprivate javax.lang.model.element.AnnotationValuesourceAnnotationValueprivate javax.lang.model.element.AnnotationValuetargetAnnotationValueprivate java.lang.StringtargetNameprivate java.util.Set<java.lang.String>targetPropertiesprivate TypetargetTypeprivate TypeFactorytypeFactory
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TargetReferencebuild()TargetReference.Buildermapping(MappingOptions mapping)private booleanmatchesSourceOnInverseSourceParameter(java.lang.String segment)Needed when we are building from inverse mapping.private booleanmatchesSourceOrTargetParameter(java.lang.String segment, Parameter targetParameter)Validates that thesegmentis the same as thetargetParameteror theinverseSourceParameternamesTargetReference.Buildermessager(FormattingMessager messager)TargetReference.Buildermethod(Method method)TargetReference.BuildertargetProperties(java.util.Set<java.lang.String> targetProperties)TargetReference.BuildertargetType(Type targetType)TargetReference.BuildertypeFactory(TypeFactory typeFactory)
-
-
-
Field Detail
-
method
private Method method
-
messager
private FormattingMessager messager
-
typeFactory
private TypeFactory typeFactory
-
targetProperties
private java.util.Set<java.lang.String> targetProperties
-
targetType
private Type targetType
-
targetName
private java.lang.String targetName
-
mapping
private MappingOptions mapping
-
annotationMirror
private javax.lang.model.element.AnnotationMirror annotationMirror
-
targetAnnotationValue
private javax.lang.model.element.AnnotationValue targetAnnotationValue
-
sourceAnnotationValue
private javax.lang.model.element.AnnotationValue sourceAnnotationValue
-
-
Method Detail
-
messager
public TargetReference.Builder messager(FormattingMessager messager)
-
mapping
public TargetReference.Builder mapping(MappingOptions mapping)
-
typeFactory
public TargetReference.Builder typeFactory(TypeFactory typeFactory)
-
method
public TargetReference.Builder method(Method method)
-
targetProperties
public TargetReference.Builder targetProperties(java.util.Set<java.lang.String> targetProperties)
-
targetType
public TargetReference.Builder targetType(Type targetType)
-
build
public TargetReference build()
-
matchesSourceOrTargetParameter
private boolean matchesSourceOrTargetParameter(java.lang.String segment, Parameter targetParameter)Validates that thesegmentis the same as thetargetParameteror theinverseSourceParameternames- Parameters:
segment- that needs to be checkedtargetParameter- the target parameter if it exists- Returns:
trueif the segment matches the name of thetargetParameteror the name of theinverseSourceParameterwhen this is a inverseTargetReferenceis being built,falseotherwise
-
matchesSourceOnInverseSourceParameter
private boolean matchesSourceOnInverseSourceParameter(java.lang.String segment)
Needed when we are building from inverse mapping. It is needed, so we can remove the first level if it is needed. E.g. If we have a mapping like:@Mapping( target = "letterSignature", source = "dto.signature" )When it is inversed it will look like:@Mapping( target = "dto.signature", source = "letterSignature" )Thedtoneeds to be considered as a possibility for a target name only if a Target Reference for a inverse is created.- Parameters:
segment- that needs to be checked*- Returns:
- on match when inverse and segment matches the one and only source parameter
-
-