The Spring Framework

org.springframework.beans.factory.support
Class ManagedSet

java.lang.Object
  extended by org.springframework.beans.factory.support.ManagedSet
All Implemented Interfaces:
Iterable, Collection, Set, BeanMetadataElement, Mergeable

public class ManagedSet
extends Object
implements Set, Mergeable, BeanMetadataElement

Tag collection class used to hold managed Set values, which may include runtime bean references (to be resolved into bean objects).

Wraps a target Set, which will be a linked set if possible (that is, if running on JDK 1.4 or if Commons Collections 3.x is available).

Since:
21.01.2004
Author:
Juergen Hoeller, Rob Harrop
See Also:
CollectionFactory.createLinkedSetIfPossible(int)

Constructor Summary
ManagedSet()
           
ManagedSet(int initialCapacity)
           
ManagedSet(Set targetSet)
           
 
Method Summary
 boolean add(Object obj)
           
 boolean addAll(Collection coll)
           
 void clear()
           
 boolean contains(Object obj)
           
 boolean containsAll(Collection coll)
           
 boolean equals(Object obj)
           
 Object getSource()
          Return the configuration source Object for this metadata element (may be null).
 int hashCode()
           
 boolean isEmpty()
           
 boolean isMergeEnabled()
          Is merging enabled for this particular instance?
 Iterator iterator()
           
 Object merge(Object parent)
          Merge the current value set with that of the supplied object.
 boolean remove(Object obj)
           
 boolean removeAll(Collection coll)
           
 boolean retainAll(Collection coll)
           
 void setMergeEnabled(boolean mergeEnabled)
          Set whether merging should be enabled for this collection, in case of a 'parent' collection value being present.
 void setSource(Object source)
          Set the configuration source Object for this metadata element.
 int size()
           
 Object[] toArray()
           
 Object[] toArray(Object[] arr)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ManagedSet

public ManagedSet()

ManagedSet

public ManagedSet(int initialCapacity)

ManagedSet

public ManagedSet(Set targetSet)
Method Detail

setSource

public void setSource(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

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

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 Object merge(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
Parameters:
parent - the object to merge with
Returns:
the result of the merge operation

size

public int size()
Specified by:
size in interface Collection
Specified by:
size in interface Set

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface Set

contains

public boolean contains(Object obj)
Specified by:
contains in interface Collection
Specified by:
contains in interface Set

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface Set

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection
Specified by:
toArray in interface Set

toArray

public Object[] toArray(Object[] arr)
Specified by:
toArray in interface Collection
Specified by:
toArray in interface Set

add

public boolean add(Object obj)
Specified by:
add in interface Collection
Specified by:
add in interface Set

remove

public boolean remove(Object obj)
Specified by:
remove in interface Collection
Specified by:
remove in interface Set

containsAll

public boolean containsAll(Collection coll)
Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface Set

addAll

public boolean addAll(Collection coll)
Specified by:
addAll in interface Collection
Specified by:
addAll in interface Set

retainAll

public boolean retainAll(Collection coll)
Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface Set

removeAll

public boolean removeAll(Collection coll)
Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface Set

clear

public void clear()
Specified by:
clear in interface Collection
Specified by:
clear in interface Set

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection
Specified by:
hashCode in interface Set
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Specified by:
equals in interface Collection
Specified by:
equals in interface Set
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

The Spring Framework

Copyright © 2002-2007 The Spring Framework.