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)
Connection
setManager
in interface Connection
public java.lang.String getLabel()
Connection
getLabel
in interface Connection
public boolean containsObjects(java.lang.Object... objects)
Connection
containsObjects
in interface Connection
objects
- the objects to check forpublic boolean containsObjects(java.util.Collection<?> objects)
Connection
containsObjects
in interface Connection
objects
- the objects as a collectionpublic boolean isRemoved()
Connection
isRemoved
in interface Connection
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public MultiSet<java.lang.Object> getObjects()
Connection
getObjects
in interface Connection
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public ConnectionID getID()
Connection
getID
in interface Connection
public <T> T getObjectWithRole(java.lang.String role)
Connection
getObjectWithRole
in interface Connection
T
- The type of object that should be returned.role
- the role the returned object has to havepublic java.util.Set<java.lang.String> getRoles()
Connection
getRoles
in interface Connection
protected <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 Connection
public void setLabel(java.lang.String name)
setLabel
in interface Connection
name
- public void updated()
Connection
updated
in interface Connection