|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
com.sas.collection.CollectionMirror
public abstract class CollectionMirror
A CollectionMirror is an abstract base class for other read-only collections which "reflect" other collections. That is, the mirror class provides read-only access to another collection, but does not provide update methods. A CollectionMirror is useful for classes which wish to provide read-only access to collections they manage internally, but do not wish to allow other objects to change those internal collection.
See StaticOrderedCollection
for a case when a CollectionMirror is used.
The CollectionMirror manages ContentsChangedEvents. The mirror allows listeners to listen for ContentsChangeEvents. If the mirror has listeners, then the mirror will itself listen for ContentsChangeEvents from the original collection, and when it changes, the mirror will send a ContentsChangeEvent to all listeners. If all listeners detach from the mirror, the mirror will remove itself from the original collection.
This is an important note, because as long as there are listeners, the mirror object will itself be a listener on the original collection, which means the mirror cannot be garbage collected (the reflected collection has a reference to the mirror in its ContentsChangedEvent listener list.)
StaticCollection,
StaticOrderedCollection,
StaticDictionary,
StaticStringList,
Serialized Form| Field Summary |
|---|
| Fields inherited from class com.sas.collection.BaseCollection |
|---|
allContentsChangedListeners, mappingObject |
| Constructor Summary | |
|---|---|
protected |
CollectionMirror(com.sas.collection.ContentsChangedSource source)
Construct a collection mirror. |
| Method Summary | |
|---|---|
void |
addContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
Add a listener for the com.sas.util.ContentsChangedEvent event. |
java.lang.Object |
clone()
Clone the collection. |
void |
contentsChanged(com.sas.collection.ContentsChangedEvent event)
Handle a change event from the original collection. |
boolean |
equals(java.lang.Object object)
Test object equality. |
protected com.sas.collection.ContentsChangedSource |
getSource()
Return the source object that was passed in to the constructor. |
int |
hashCode()
Compute the object's hash code. |
void |
removeContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
Remove a listener for the com.sas.util.ContentsChangedEvent event. |
java.lang.String |
toString()
Convert the object to a string. |
| Methods inherited from class com.sas.collection.BaseCollection |
|---|
anyContentsChangedListeners, apply, contains, count, disableEvents, enableEvents, enableEvents, fireContentsChanged, getItems, map, unmap |
| Methods inherited from interface com.sas.beans.PropertyChangeSource |
|---|
addPropertyChangeListener, removePropertyChangeListener |
| Constructor Detail |
|---|
protected CollectionMirror(com.sas.collection.ContentsChangedSource source)
source - another collection that acts as
a source of ContentsChangedEvent events.| Method Detail |
|---|
protected final com.sas.collection.ContentsChangedSource getSource()
public void addContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
addContentsChangedListener in interface com.sas.collection.ContentsChangedSourceaddContentsChangedListener in class BaseCollectionlistener - an object which handles ContentsChangedEvent events
the listener is not added a second time if it already exists
in the list of listeners for this event.ContentsChangedSourcepublic void removeContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
removeContentsChangedListener in interface com.sas.collection.ContentsChangedSourceremoveContentsChangedListener in class BaseCollectionlistener - an object which handles ContentsChangedEvent eventsContentsChangedSourcepublic void contentsChanged(com.sas.collection.ContentsChangedEvent event)
contentsChanged in interface com.sas.collection.ContentsChangedListenerevent - an event from the original source.public java.lang.String toString()
toString in class java.lang.Object
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface StaticCollectionInterfaceclone in interface com.sas.PublicClonableclone in class BaseCollectionjava.lang.CloneNotSupportedException - is the mirror or the underlying
collection cannot be cloned.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object object)
equals in class java.lang.Objecttrue if this object equals another
object, else return false
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||