Class ExistingInstanceSetterWrapperForCollectionsAndMaps
- java.lang.Object
- 
- org.mapstruct.ap.internal.writer.FreeMarkerWritable
- 
- org.mapstruct.ap.internal.model.common.ModelElement
- 
- org.mapstruct.ap.internal.model.assignment.AssignmentWrapper
- 
- org.mapstruct.ap.internal.model.assignment.WrapperForCollectionsAndMaps
- 
- org.mapstruct.ap.internal.model.assignment.SetterWrapperForCollectionsAndMapsWithNullCheck
- 
- org.mapstruct.ap.internal.model.assignment.ExistingInstanceSetterWrapperForCollectionsAndMaps
 
 
 
 
 
 
- 
- All Implemented Interfaces:
- Assignment,- Writable
 
 public class ExistingInstanceSetterWrapperForCollectionsAndMaps extends SetterWrapperForCollectionsAndMapsWithNullCheck This wrapper handles the situation where an assignment is done for an update method. In case of a pre-existing target the wrapper checks if there is a collection or map initialized on the target bean (not null). If so it uses the addAll (for collections) or putAll (for maps). The collection / map is cleared in case of a pre-existing targetMappingTargetbefore adding the source entries. If there is no pre-existing target, or the target Collection / Map is not initialized (null) the setter is used to create a new Collection / Map with the copy constructor.- Author:
- Sjaak Derksen
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.mapstruct.ap.internal.model.common.AssignmentAssignment.AssignmentType
 - 
Nested classes/interfaces inherited from interface org.mapstruct.ap.internal.writer.WritableWritable.Context
 
- 
 - 
Field Summary- 
Fields inherited from class org.mapstruct.ap.internal.model.assignment.AssignmentWrapperfieldAssignment
 
- 
 - 
Constructor SummaryConstructors Constructor Description ExistingInstanceSetterWrapperForCollectionsAndMaps(Assignment decoratedAssignment, List<Type> thrownTypesToExclude, Type targetType, org.mapstruct.ap.internal.gem.NullValueCheckStrategyGem nvcs, org.mapstruct.ap.internal.gem.NullValuePropertyMappingStrategyGem nvpms, TypeFactory typeFactory, boolean fieldAssignment)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<Type>getImportTypes()Returns a set containing thoseTypes referenced by this model element for which an import statement needs to be declared.booleanisIncludeElseBranch()booleanisMapNullToDefault()- 
Methods inherited from class org.mapstruct.ap.internal.model.assignment.SetterWrapperForCollectionsAndMapsWithNullCheckisDirectAssignment, isEnumSet
 - 
Methods inherited from class org.mapstruct.ap.internal.model.assignment.WrapperForCollectionsAndMapsgetNullCheckLocalVarName, getNullCheckLocalVarType, getThrownTypes
 - 
Methods inherited from class org.mapstruct.ap.internal.model.assignment.AssignmentWrappercreateUniqueVarName, getAssignment, getSourceLocalVarName, getSourceLoopVarName, getSourceParameterName, getSourcePresenceCheckerReference, getSourceReference, getSourceType, getType, isCallingUpdateMethod, isFieldAssignment, isSourceReferenceParameter, setAssignment, setSourceLocalVarName, setSourceLoopVarName
 - 
Methods inherited from class org.mapstruct.ap.internal.writer.FreeMarkerWritablegetTemplateName, getTemplateNameForClass, write
 
- 
 
- 
- 
- 
Constructor Detail- 
ExistingInstanceSetterWrapperForCollectionsAndMapspublic ExistingInstanceSetterWrapperForCollectionsAndMaps(Assignment decoratedAssignment, List<Type> thrownTypesToExclude, Type targetType, org.mapstruct.ap.internal.gem.NullValueCheckStrategyGem nvcs, org.mapstruct.ap.internal.gem.NullValuePropertyMappingStrategyGem nvpms, TypeFactory typeFactory, boolean fieldAssignment) 
 
- 
 - 
Method Detail- 
getImportTypespublic Set<Type> getImportTypes() Description copied from class:ModelElementReturns a set containing thoseTypes referenced by this model element for which an import statement needs to be declared.- Specified by:
- getImportTypesin interface- Assignment
- Overrides:
- getImportTypesin class- SetterWrapperForCollectionsAndMapsWithNullCheck
- Returns:
- A set with type referenced by this model element. Must not be null.
 
 - 
isIncludeElseBranchpublic boolean isIncludeElseBranch() 
 - 
isMapNullToDefaultpublic boolean isMapNullToDefault() 
 
- 
 
-