public abstract class AbstractConnection extends java.lang.Object implements Connection
| Modifier and Type | Field and Description |
|---|---|
protected ConnectionManager |
manager |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractConnection(java.lang.String label) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsObjects(java.util.Collection<?> objects)
Return true if all objects given as parameter are contained in the
connection.
|
boolean |
containsObjects(java.lang.Object... objects)
Return true if all objects given as parameter are contained in the
connection.
|
boolean |
equals(java.lang.Object o) |
protected java.lang.Object |
get(java.lang.String role) |
ConnectionID |
getID()
Return the ID of the connection.
|
java.lang.String |
getLabel()
Return the label of the connection
|
protected java.util.Map<java.lang.String,java.lang.ref.WeakReference<?>> |
getMapping() |
MultiSet<java.lang.Object> |
getObjects()
Return all objects contained in this connection, without their labels.
|
<T> T |
getObjectWithRole(java.lang.String role)
Return the object with the given role in this connection The type of the
returned object is T.
|
java.util.Set<java.lang.String> |
getRoles()
Return the roles of all objects in this connection
|
int |
hashCode() |
boolean |
isRemoved()
Return true if one of the objects connected by this connection no longer
exists, i.e.
|
protected <T> java.lang.ref.WeakReference<T> |
put(java.lang.String role,
T o) |
void |
remove()
Removes the connection.
|
protected void |
remove(java.lang.String role) |
void |
setLabel(java.lang.String name)
sets the label of the connection to the new name
|
void |
setManager(ConnectionManager manager)
Sets the manager for the connection.
|
java.lang.String |
toString() |
void |
updated()
This method should be called as soon as the connection is changed, for
example if the label changed, or if the contents of one of the connected
objects changes.
|
protected transient ConnectionManager manager
public void setManager(ConnectionManager manager)
ConnectionsetManager in interface Connectionpublic java.lang.String getLabel()
ConnectiongetLabel in interface Connectionpublic boolean containsObjects(java.lang.Object... objects)
ConnectioncontainsObjects in interface Connectionobjects - the objects to check forpublic boolean containsObjects(java.util.Collection<?> objects)
ConnectioncontainsObjects in interface Connectionobjects - the objects as a collectionpublic boolean isRemoved()
ConnectionisRemoved in interface Connectionpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic MultiSet<java.lang.Object> getObjects()
ConnectiongetObjects in interface Connectionpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic ConnectionID getID()
ConnectiongetID in interface Connectionpublic <T> T getObjectWithRole(java.lang.String role)
ConnectiongetObjectWithRole in interface ConnectionT - The type of object that should be returned.role - the role the returned object has to havepublic java.util.Set<java.lang.String> getRoles()
ConnectiongetRoles in interface Connectionprotected <T> java.lang.ref.WeakReference<T> put(java.lang.String role,
T o)
protected void remove(java.lang.String role)
protected java.lang.Object get(java.lang.String role)
protected java.util.Map<java.lang.String,java.lang.ref.WeakReference<?>> getMapping()
public void remove()
remove in interface Connectionpublic void setLabel(java.lang.String name)
setLabel in interface Connectionname - public void updated()
Connectionupdated in interface Connection