Class ManagedSet<E>

Type Parameters:
E - the element type
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, Set<E>, BeanMetadataElement, Mergeable

public class ManagedSet<E> extends LinkedHashSet<E> implements Mergeable, BeanMetadataElement
Tag collection class used to hold managed Set values, which may include runtime bean references (to be resolved into bean objects).
Juergen Hoeller, Rob Harrop, Stephane Nicoll, Sam Brannen
See Also:
  • Constructor Details

    • ManagedSet

      public ManagedSet()
    • ManagedSet

      public ManagedSet(int initialCapacity)
  • Method Details

    • of

      @SafeVarargs public static <E> ManagedSet<E> of(E... elements)
      Create a new instance containing an arbitrary number of elements.
      Type Parameters:
      E - the Set's element type
      elements - the elements to be contained in the set
      a ManagedSet containing the specified elements
    • setSource

      public void setSource(@Nullable Object source)
      Set the configuration source Object for this metadata element.

      The exact type of the object will depend on the configuration mechanism used.

    • getSource

      @Nullable public Object getSource()
      Description copied from interface: BeanMetadataElement
      Return the configuration source Object for this metadata element (may be null).
      Specified by:
      getSource in interface BeanMetadataElement
    • setElementTypeName

      public void setElementTypeName(@Nullable String elementTypeName)
      Set the default element type name (class name) to be used for this set.
    • getElementTypeName

      @Nullable public String getElementTypeName()
      Return the default element type name (class name) to be used for this set.
    • setMergeEnabled

      public void setMergeEnabled(boolean mergeEnabled)
      Set whether merging should be enabled for this collection, in case of a 'parent' collection value being present.
    • isMergeEnabled

      public boolean isMergeEnabled()
      Description copied from interface: Mergeable
      Is merging enabled for this particular instance?
      Specified by:
      isMergeEnabled in interface Mergeable
    • merge

      public Set<E> merge(@Nullable Object parent)
      Description copied from interface: Mergeable
      Merge the current value set with that of the supplied object.

      The supplied object is considered the parent, and values in the callee's value set must override those of the supplied object.

      Specified by:
      merge in interface Mergeable
      parent - the object to merge with
      the result of the merge operation