Class GetterWrapperForCollectionsAndMaps

  • All Implemented Interfaces:
    Assignment, Writable

    public class GetterWrapperForCollectionsAndMaps
    extends WrapperForCollectionsAndMaps
    This wrapper handles the situation were an assignment must be done via a target getter method because there is no setter available. 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 target MappingTargetbefore adding the source entries. The goal is that the same collection / map is used as target. Nothing can be added if the getter on the target returns null.
    Author:
    Sjaak Derksen
    • Constructor Detail

      • GetterWrapperForCollectionsAndMaps

        public GetterWrapperForCollectionsAndMaps​(Assignment decoratedAssignment,
                                                  List<Type> thrownTypesToExclude,
                                                  Type targetType,
                                                  boolean fieldAssignment)
        Parameters:
        decoratedAssignment - source RHS
        thrownTypesToExclude - set of types to exclude from re-throwing
        targetType - the target type
        fieldAssignment - true when this the assignment is to a field rather than via accessors
    • Method Detail

      • getImportTypes

        public Set<Type> getImportTypes()
        Description copied from class: ModelElement
        Returns a set containing those Types referenced by this model element for which an import statement needs to be declared.
        Specified by:
        getImportTypes in interface Assignment
        Overrides:
        getImportTypes in class AssignmentWrapper
        Returns:
        A set with type referenced by this model element. Must not be null.