|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gumbo.util.AbstractDisposable | +--gumbo.util.AbstractDelegatable | +--gumbo.util.AbstractDelegatable.Serial | +--gumbo.util.relation.AbstractRelation
A full implementation of the Relation interface, with serialization. Serialization includes this relation and its relationship, but not its relation event listeners. The default Disposable implementation nulls the delegator reference and disconnects any relation event listeners. Subclasses should override implDispose() to also disconnect this relation from any adjacent relations to maintain consistency in the relationship.
Concrete relations generally implement specific connection types and mutators. Typically, a chain of responsibility is established such that a specific check calls a more general check, and so on. Checking can enforce compatibility and mutability constraints actively and/or passively. Active enforcement involves changing the state of this relation to conform (such as automaticaly setting a dead relation's relationship). Passive enforcement throws an exception if a non-conformance is detected (a relation involved in the connection is dead).
The most general check for relation connection is provided here by checkRelation(). For example, in a tree node, the addChild() mutator would call checkAddChild() to check the specific mutation, which would call checkChild() to check the specific connection, which would call checkRelation() to check the general connection. Depending on the type of delegation used for the relation, check methods may use relation or delegator parameters.
Nested Class Summary |
Nested classes inherited from class gumbo.util.AbstractDelegatable |
AbstractDelegatable.Serial |
Constructor Summary | |
AbstractRelation(Relationship relationship)
Creates an instance with an uninitialized delegator. |
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. |
protected void |
checkClearedRelationship(Relationship relationship)
Called by the system after clearing this relation's relationship. |
protected void |
checkRelation(Relation relation)
Called by subclasses to check a relation and its delegator before connecting it to this relation. |
protected void |
checkSettingRelationship(Relationship relationship)
Called by the system before setting this relation's relationship. |
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. |
protected void |
implDispose()
Called during disposal while the base class is still valid. |
protected void |
initedDelegator()
If the relationship is not null, calls its implAddRelation(this). |
void |
setRelationship(Relationship relationship)
Ignores no change in relationship, calls checkClearedRelationship() after setting the relationship null, and checkSettingRelationship() before setting it non-null. |
java.lang.String |
toString()
|
Methods inherited from class gumbo.util.AbstractDelegatable |
getDelegator, initDelegator, initingDelegator, isDelegatorInited |
Methods inherited from class gumbo.util.AbstractDisposable |
dispose, isDisposed |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface gumbo.util.relation.Relation |
implReadConnections, implWriteConnections |
Methods inherited from interface gumbo.util.Disposable |
dispose, isDisposed |
Methods inherited from interface gumbo.util.Delegatable |
getDelegator, initDelegator, isDelegatorInited |
Constructor Detail |
public AbstractRelation(Relationship relationship)
new AbstractRelation(r).initDelegator(d)
.
relationship
- This relation's relationship. Null if none
(a dead relation).Method Detail |
protected void checkRelation(Relation relation)
relation
- The relation. Possibly null or this relation
(self-connection).protected void checkSettingRelationship(Relationship relationship)
relationship
- The new relationship. Never null.protected void checkClearedRelationship(Relationship relationship)
relationship
- The old relationship. Never null.public void setRelationship(Relationship relationship)
setRelationship
in interface Relation
relationship
- The relationship. Null if none (dead).public Relationship getRelationship()
Relation
getRelationship
in interface Relation
public boolean canFindRelation(java.lang.Object delegator)
Relation
canFindRelation
in interface Relation
delegator
- The delegator. Returns false if null.
public Relation findRelation(java.lang.Object delegator)
Relation
findRelation
in interface Relation
delegator
- The delegator. Never null.
public final ConnectionField.EventOut getAddedConnectionOut()
Relation
getAddedConnectionOut
in interface Relation
public final ConnectionField.EventOut getRemovingConnectionOut()
Relation
getRemovingConnectionOut
in interface Relation
protected void initedDelegator()
initedDelegator
in class AbstractDelegatable
protected void implDispose()
implDispose
in class AbstractDelegatable
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |