net.walend.collection.lyophil
Class FreezableDelegatingMutableSet
java.lang.Object
|
+--net.walend.lyophil.collection.DelegatingMutableSet
|
+--net.walend.collection.lyophil.FreezableDelegatingMutableSet
- All Implemented Interfaces:
- Collection, CollectionOfFreezables, Freezable, FreezableSet, HasState, MutableCollection, MutableCollectionOfFreezables, MutableSet, MutableSetOfFreezables, java.io.Serializable, Set, SetOfFreezables
- public class FreezableDelegatingMutableSet
- extends DelegatingMutableSet
- implements FreezableSet
This class extends the DelegatingMutableSet to implement FreezableSet. This class is a "freezer-backed"
implementation of FreezableSet.
- Since:
- 2-13-2001
- Author:
- David Walend
Method Summary |
protected MutableSetOfFreezables |
createDelegate()
Only called by DelegatingMutableSet's constructor. |
Freezable |
createEvilClone(Mother mom,
java.lang.String role)
Returns a new instance of a Freezable with the same internal state as this Freezable, but with the new id. |
java.io.Serializable |
getIdentifier()
Get the identifier for this instance. |
java.lang.String |
getRole()
Get the role for this instance. |
boolean |
sameAs(Freezable object)
Returns true if this Freezable represents the samee information as object, and their internal state matches. |
boolean |
sameIdentifierAs(Freezable object)
Returns true if this Freezable represents the same information as the Freezable object, ie if they
have the same identifier. |
Methods inherited from class net.walend.lyophil.collection.DelegatingMutableSet |
add, add, addAll, addAllIdentifiedBy, addIdentifiedBy, clear, contains, contains, containsAll, containsAllIdentifiedBy, containsIdentifiedBy, freezableIterator, getDelegate, getIdentifiers, getIdentitor, getJavaCollection, getJavaSet, getPrincipleInterface, identifierIterator, isEmpty, iterator, remove, remove, removeAll, removeAllIdentifiedBy, removeIdentifiedBy, retainAll, retainAllIdentifiedBy, sameContentsAs, sameStateAs, size, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.walend.collection.Set |
getJavaSet |
DELEGATEPROPERTYKEY
public static final java.lang.String DELEGATEPROPERTYKEY
id
private java.io.Serializable id
role
private java.lang.String role
FreezableDelegatingMutableSet
public FreezableDelegatingMutableSet(java.io.Serializable identifier,
java.lang.String role,
Mother mom)
FreezableDelegatingMutableSet
public FreezableDelegatingMutableSet(java.io.Serializable identifier,
java.lang.String role,
Mother mom,
CollectionOfFreezables c)
FreezableDelegatingMutableSet
public FreezableDelegatingMutableSet(java.io.Serializable identifier,
java.lang.String role,
Mother mom,
FreezableDelegatingMutableSet c)
- Creates a new Set that is a copy of c
createDelegate
protected MutableSetOfFreezables createDelegate()
- Only called by DelegatingMutableSet's constructor. Override this method to change the delegate MutableSet.
- Specified by:
createDelegate
in class DelegatingMutableSet
getIdentifier
public java.io.Serializable getIdentifier()
- Description copied from interface:
Freezable
- Get the identifier for this instance. I've always used a Long, but the ejb spec says it can be anything. Try to use
something immutable. Note that you will only have this Object plus metadetails of the class to use for identifier
information. All you should need is the identifier.
- Specified by:
getIdentifier
in interface Freezable
getRole
public java.lang.String getRole()
- Description copied from interface:
Freezable
- Get the role for this instance.
- Specified by:
getRole
in interface Freezable
sameIdentifierAs
public boolean sameIdentifierAs(Freezable object)
- Description copied from interface:
Freezable
- Returns true if this Freezable represents the same information as the Freezable object, ie if they
have the same identifier.
- Specified by:
sameIdentifierAs
in interface Freezable
sameAs
public boolean sameAs(Freezable object)
- Description copied from interface:
Freezable
- Returns true if this Freezable represents the samee information as object, and their internal state matches.
- Specified by:
sameAs
in interface Freezable
createEvilClone
public Freezable createEvilClone(Mother mom,
java.lang.String role)
- Description copied from interface:
Freezable
- Returns a new instance of a Freezable with the same internal state as this Freezable, but with the new id. This method
should only be called by Mother.
- Specified by:
createEvilClone
in interface Freezable
Copyright (c) 2000, 2001, David Walend