Class SourceReference.BuilderFromMapping
- java.lang.Object
-
- org.mapstruct.ap.internal.model.beanmapping.SourceReference.BuilderFromMapping
-
- Enclosing class:
- SourceReference
public static class SourceReference.BuilderFromMapping extends java.lang.ObjectBuilds aSourceReferencefrom an@Mappping.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.lang.model.element.AnnotationMirrorannotationMirrorprivate booleanisForwardedprivate FormattingMessagermessagerprivate Methodmethodprivate javax.lang.model.element.AnnotationValuesourceAnnotationValueprivate java.lang.StringsourceNameprivate MethodtemplateMethodprivate TypeFactorytypeFactory
-
Constructor Summary
Constructors Constructor Description BuilderFromMapping()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SourceReferencebuild()private SourceReferencebuildFromMultipleSourceParameters(java.lang.String[] segments, Parameter parameter)When there are more than one source parameters, the first segment name of the property needs to match the parameter name to avoid ambiguityprivate SourceReferencebuildFromSingleSourceParameters(java.lang.String[] segments, Parameter parameter)When there is only one source parameters, the first segment name of the property may, or may not match the parameter name to avoid ambiguity consider:Target map( Source1 source1 )entries in a @Mapping#source can be "source1.propx" or just "propx" to be validprivate ParameterfetchMatchingParameterFromFirstSegment(java.lang.String[] segments)When there are more than one source parameters, the first segment name of the property needs to match the parameter name to avoid ambiguity consider:Target map( Source1 source1, Source2 source2 )entries in a @Mapping#source need to be "source1.propx" or "source2.propy.propz" to be validprivate ParametergetSourceParameterFromMethodOrTemplate(java.lang.String parameterName)SourceReference.BuilderFromMappingmapping(MappingOptions mapping)private java.util.List<PropertyEntry>matchWithSourceAccessorTypes(Type type, java.lang.String[] entryNames)SourceReference.BuilderFromMappingmessager(FormattingMessager messager)SourceReference.BuilderFromMappingmethod(Method method)private voidreportErrorOnNoMatch(Parameter parameter, java.lang.String[] propertyNames, java.util.List<PropertyEntry> entries)private voidreportMappingError(Message msg, java.lang.Object... objects)SourceReference.BuilderFromMappingsourceName(java.lang.String sourceName)SourceReference.BuilderFromMappingtypeFactory(TypeFactory typeFactory)
-
-
-
Field Detail
-
method
private Method method
-
messager
private FormattingMessager messager
-
typeFactory
private TypeFactory typeFactory
-
isForwarded
private boolean isForwarded
-
templateMethod
private Method templateMethod
-
sourceName
private java.lang.String sourceName
-
annotationMirror
private javax.lang.model.element.AnnotationMirror annotationMirror
-
sourceAnnotationValue
private javax.lang.model.element.AnnotationValue sourceAnnotationValue
-
-
Method Detail
-
messager
public SourceReference.BuilderFromMapping messager(FormattingMessager messager)
-
mapping
public SourceReference.BuilderFromMapping mapping(MappingOptions mapping)
-
method
public SourceReference.BuilderFromMapping method(Method method)
-
typeFactory
public SourceReference.BuilderFromMapping typeFactory(TypeFactory typeFactory)
-
sourceName
public SourceReference.BuilderFromMapping sourceName(java.lang.String sourceName)
-
build
public SourceReference build()
-
buildFromSingleSourceParameters
private SourceReference buildFromSingleSourceParameters(java.lang.String[] segments, Parameter parameter)
When there is only one source parameters, the first segment name of the property may, or may not match the parameter name to avoid ambiguity consider:Target map( Source1 source1 )entries in a @Mapping#source can be "source1.propx" or just "propx" to be valid- Parameters:
segments- the segments of @Mapping#sourceparameter- the one and only parameter- Returns:
- the source reference
-
buildFromMultipleSourceParameters
private SourceReference buildFromMultipleSourceParameters(java.lang.String[] segments, Parameter parameter)
When there are more than one source parameters, the first segment name of the property needs to match the parameter name to avoid ambiguity- Parameters:
segments- the segments of @Mapping#sourceparameter- the relevant source parameter- Returns:
- the source reference
-
fetchMatchingParameterFromFirstSegment
private Parameter fetchMatchingParameterFromFirstSegment(java.lang.String[] segments)
When there are more than one source parameters, the first segment name of the property needs to match the parameter name to avoid ambiguity consider:Target map( Source1 source1, Source2 source2 )entries in a @Mapping#source need to be "source1.propx" or "source2.propy.propz" to be valid- Parameters:
segments- the segments of @Mapping#source- Returns:
- parameter that matches with first segment of @Mapping#source
-
getSourceParameterFromMethodOrTemplate
private Parameter getSourceParameterFromMethodOrTemplate(java.lang.String parameterName)
-
reportErrorOnNoMatch
private void reportErrorOnNoMatch(Parameter parameter, java.lang.String[] propertyNames, java.util.List<PropertyEntry> entries)
-
matchWithSourceAccessorTypes
private java.util.List<PropertyEntry> matchWithSourceAccessorTypes(Type type, java.lang.String[] entryNames)
-
reportMappingError
private void reportMappingError(Message msg, java.lang.Object... objects)
-
-