gumbo.util.relation
Class Relations.RelationWrapper

java.lang.Object
  |
  +--gumbo.util.Delegatables.DelegatableWrapper
        |
        +--gumbo.util.relation.Relations.RelationWrapper
All Implemented Interfaces:
Delegatable, Disposable, Relation, java.io.Serializable
Direct Known Subclasses:
TreeNodes.TreeNodeWrapper
Enclosing class:
Relations

public static class Relations.RelationWrapper
extends Delegatables.DelegatableWrapper
implements Relation, java.io.Serializable

A serializable wrapper for a target Relation. All accessors, including identity, forward to the target.

See Also:
Serialized Form

Constructor Summary
Relations.RelationWrapper(Relation target)
           
 
Method Summary
 boolean canFindRelation(java.lang.Object delegator)
          Convenience method that returns true if a relation corresponding to a delegator can be found in this relation's relationship.
 void dispose()
          Disposes this object and its dependencies, making this object inactive and unusable.
 Relation findRelation(java.lang.Object delegator)
          Convenience method for getting the relation corresponding to a delegator in this relation's relationship.
 ConnectionField.EventOut getAddedConnectionOut()
          Sends a connection involving this relation after the connection is created.
 Relationship getRelationship()
          Gets the relationship that this relation belongs to.
 ConnectionField.EventOut getRemovingConnectionOut()
          Sends a connection involving this relation before the connection is destroyed.
 void implReadConnections(java.io.ObjectInputStream s)
          Called by the system during deserialization when this relation should read its connection references from the serial input stream.
 void implWriteConnections(java.io.ObjectOutputStream s)
          Called by the system during serialization when this relation should write its connection references to the serial output stream.
 boolean isDisposed()
          Returns whether or not this object has been disposed (dispose() has been previously called).
 void setRelationship(Relationship relationship)
          Sets the relationship that this relation belongs to.
 
Methods inherited from class gumbo.util.Delegatables.DelegatableWrapper
getDelegator, initDelegator, isDelegatorInited
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gumbo.util.Delegatable
getDelegator, initDelegator, isDelegatorInited
 

Constructor Detail

Relations.RelationWrapper

public Relations.RelationWrapper(Relation target)
Parameters:
target - Wrapped target. Never null.
Method Detail

setRelationship

public void setRelationship(Relationship relationship)
Description copied from interface: Relation
Sets the relationship that this relation belongs to. If this relation is going dead implementors must satisfy the relation contract by actively disconnecting it from all relations, or passively throwing an exception. Unless otherwise noted, no change in relationship is ignored.

Specified by:
setRelationship in interface Relation
Parameters:
relationship - The relationship. Null if none (dead).

getRelationship

public Relationship getRelationship()
Description copied from interface: Relation
Gets the relationship that this relation belongs to.

Specified by:
getRelationship in interface Relation
Returns:
The relationship. If null, this relation is dead; if non-null it is live.

canFindRelation

public boolean canFindRelation(java.lang.Object delegator)
Description copied from interface: Relation
Convenience method that returns true if a relation corresponding to a delegator can be found in this relation's relationship.

Specified by:
canFindRelation in interface Relation
Parameters:
delegator - The delegator. Returns false if null.
Returns:
The result. False if this relation is not in a relationship or delegator is null.

findRelation

public Relation findRelation(java.lang.Object delegator)
Description copied from interface: Relation
Convenience method for getting the relation corresponding to a delegator in this relation's relationship.

Specified by:
findRelation in interface Relation
Parameters:
delegator - The delegator. Never null.
Returns:
The delegator's relation. Never null.

getAddedConnectionOut

public ConnectionField.EventOut getAddedConnectionOut()
Description copied from interface: Relation
Sends a connection involving this relation after the connection is created. Never null.

Specified by:
getAddedConnectionOut in interface Relation

getRemovingConnectionOut

public ConnectionField.EventOut getRemovingConnectionOut()
Description copied from interface: Relation
Sends a connection involving this relation before the connection is destroyed. Never null.

Specified by:
getRemovingConnectionOut in interface Relation

implWriteConnections

public void implWriteConnections(java.io.ObjectOutputStream s)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException
Description copied from interface: Relation
Called by the system during serialization when this relation should write its connection references to the serial output stream. Connection references must be declared as transient so that they are written only by this method, which is called after all relationship objects (delegators and relations) have been written during normal serialization.

Specified by:
implWriteConnections in interface Relation
Parameters:
s - Output stream. Never null.
java.io.IOException
java.lang.ClassNotFoundException

implReadConnections

public void implReadConnections(java.io.ObjectInputStream s)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
Description copied from interface: Relation
Called by the system during deserialization when this relation should read its connection references from the serial input stream. Connection references must be declared as transient so that they are read only by this method, which is called after all relationship objects (delegators and relations) have been read during normal serialization.

Specified by:
implReadConnections in interface Relation
Parameters:
s - Output stream. Never null.
java.io.IOException
java.lang.ClassNotFoundException

dispose

public void dispose()
Description copied from interface: Disposable
Disposes this object and its dependencies, making this object inactive and unusable. Subsequent calls to this object's accessors should throw IllegalStateException. If the object is already disposed nothing happens.

Specified by:
dispose in interface Disposable

isDisposed

public boolean isDisposed()
Description copied from interface: Disposable
Returns whether or not this object has been disposed (dispose() has been previously called).

Specified by:
isDisposed in interface Disposable
Returns:
True if this object has been disposed.