public abstract class AbstractBasicRelationSupport<SourceType extends BrooklynObject> extends java.lang.Object implements BrooklynObjectInternal.RelationSupportInternal<SourceType>
EntityRelations
for all changes, routing through a local backing store.
This allows us to make the changes in both directions simultaneously when a relationship is bi-directional,
and should facilitate changing a backing datastore or remote instances when that is supported.
Currently it can be implemented without it, simplifying things a bit (avoiding the double dispatch)
apart from the add(RelationshipType, BrooklynObject)
method triggering the reverse addition
if it isn't already present. TBD which is better (and the internal call to get the backing store is
marked as Beta).
Constructor and Description |
---|
AbstractBasicRelationSupport(SourceType source) |
Modifier and Type | Method and Description |
---|---|
<U extends BrooklynObject> |
add(RelationshipType<? super SourceType,? super U> relationship,
U target)
Adds a relationship of the given type from this object pointing at the given target,
and ensures that the inverse relationship (if there is one) is present at the target pointing back at this object.
|
<U extends BrooklynObject> |
getRelations(RelationshipType<? super SourceType,U> relationship) |
java.util.Set<RelationshipType<? super SourceType,? extends BrooklynObject>> |
getRelationshipTypes() |
<U extends BrooklynObject> |
remove(RelationshipType<? super SourceType,? super U> relationship,
U target)
Removes any and all relationships of the given type from this object pointing at the given target,
and ensures that the inverse relationships (if there are one) are also removed.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLocalBackingStore
public AbstractBasicRelationSupport(SourceType source)
public java.util.Set<RelationshipType<? super SourceType,? extends BrooklynObject>> getRelationshipTypes()
getRelationshipTypes
in interface BrooklynObject.RelationSupport<SourceType extends BrooklynObject>
RelationshipType
s originating from this objectpublic <U extends BrooklynObject> java.util.Set<U> getRelations(RelationshipType<? super SourceType,U> relationship)
getRelations
in interface BrooklynObject.RelationSupport<SourceType extends BrooklynObject>
BrooklynObject
s which are targets of the given RelationshipType
public <U extends BrooklynObject> void add(RelationshipType<? super SourceType,? super U> relationship, U target)
BrooklynObject.RelationSupport
add
in interface BrooklynObject.RelationSupport<SourceType extends BrooklynObject>
public <U extends BrooklynObject> void remove(RelationshipType<? super SourceType,? super U> relationship, U target)
BrooklynObject.RelationSupport
remove
in interface BrooklynObject.RelationSupport<SourceType extends BrooklynObject>