Package org.mapstruct.ap.internal.model
Class CollectionAssignmentBuilder
- java.lang.Object
-
- org.mapstruct.ap.internal.model.CollectionAssignmentBuilder
-
public class CollectionAssignmentBuilder extends java.lang.ObjectA builder that is used for creating an assignment to a collection. The created assignments to the following null checks:- source-null-check - For this the
SetterWrapperForCollectionsAndMapsWithNullCheckis used when a direct assignment is done or theNullValueCheckStrategyisNullValueCheckStrategy.ALWAYS. It is also done inExistingInstanceSetterWrapperForCollectionsAndMapswhich extendsSetterWrapperForCollectionsAndMapsWithNullCheck - target-null-check - Done in the
ExistingInstanceSetterWrapperForCollectionsAndMaps - local-var-null-check - Done in
ExistingInstanceSetterWrapperForCollectionsAndMaps, andSetterWrapperForCollectionsAndMapsWithNullCheck
- Presence check with direct assignment - We need a null check before setting, because we use the copy constructor
- Presence check for existing instance mapping - We need the null check because we call addAll / putAll.
- No Presence check and direct assignment - We use the copy constructor
- No Presence check and
NullValueCheckStrategy.ALWAYS- the user requested one
- source-null-check - For this the
-
-
Field Summary
Fields Modifier and Type Field Description private Assignmentassignmentprivate MappingBuilderContextctxprivate Methodmethodprivate NullValueCheckStrategyGemnvcsprivate NullValuePropertyMappingStrategyGemnvpmsprivate SourceRHSsourceRHSprivate AccessorTypetargetAccessorTypeprivate java.lang.StringtargetPropertyNameprivate AccessortargetReadAccessorprivate TypetargetType
-
Constructor Summary
Constructors Constructor Description CollectionAssignmentBuilder()
-
Method Summary
-
-
-
Field Detail
-
ctx
private MappingBuilderContext ctx
-
method
private Method method
-
targetReadAccessor
private Accessor targetReadAccessor
-
targetType
private Type targetType
-
targetPropertyName
private java.lang.String targetPropertyName
-
targetAccessorType
private AccessorType targetAccessorType
-
assignment
private Assignment assignment
-
sourceRHS
private SourceRHS sourceRHS
-
nvcs
private NullValueCheckStrategyGem nvcs
-
nvpms
private NullValuePropertyMappingStrategyGem nvpms
-
-
Method Detail
-
mappingBuilderContext
public CollectionAssignmentBuilder mappingBuilderContext(MappingBuilderContext ctx)
-
method
public CollectionAssignmentBuilder method(Method method)
-
targetReadAccessor
public CollectionAssignmentBuilder targetReadAccessor(Accessor targetReadAccessor)
-
targetType
public CollectionAssignmentBuilder targetType(Type targetType)
-
targetPropertyName
public CollectionAssignmentBuilder targetPropertyName(java.lang.String targetPropertyName)
-
targetAccessorType
public CollectionAssignmentBuilder targetAccessorType(AccessorType targetAccessorType)
-
assignment
public CollectionAssignmentBuilder assignment(Assignment assignment)
- Parameters:
assignment- the assignment that needs to be invoked- Returns:
- this builder for chaining
-
rightHandSide
public CollectionAssignmentBuilder rightHandSide(SourceRHS sourceRHS)
- Parameters:
sourceRHS- the source right hand side for getting the property for mapping- Returns:
- this builder for chaining
-
nullValueCheckStrategy
public CollectionAssignmentBuilder nullValueCheckStrategy(NullValueCheckStrategyGem nvcs)
-
nullValuePropertyMappingStrategy
public CollectionAssignmentBuilder nullValuePropertyMappingStrategy(NullValuePropertyMappingStrategyGem nvpms)
-
build
public Assignment build()
-
canBeMappedOrDirectlyAssigned
private boolean canBeMappedOrDirectlyAssigned(Assignment result)
-
setterWrapperNeedsSourceNullCheck
private boolean setterWrapperNeedsSourceNullCheck(Assignment rhs)
Checks whether the setter wrapper should include a null / presence check or not- Parameters:
rhs- the source right hand side- Returns:
- whether to include a null / presence check or not
-
hasCopyConstructor
private boolean hasCopyConstructor()
-
hasNoArgsConstructor
private boolean hasNoArgsConstructor()
-
checkConstructorForPredicate
private boolean checkConstructorForPredicate(java.util.function.Predicate<javax.lang.model.element.Element> predicate)
-
hasNoArgsConstructor
private boolean hasNoArgsConstructor(javax.lang.model.element.Element element)
-
hasCopyConstructor
private boolean hasCopyConstructor(javax.lang.model.element.Element element)
-
-