|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.commands.common.EventManager
org.eclipse.core.commands.common.HandleObject
public abstract class HandleObject
An object that can exist in one of two states: defined and undefined. This is used by APIs that want to give a handle to an object, even though the object does not fully exist yet. This way, users can attach listeners to objects before they come into existence. It also protects the API from users that do not release references when they should.
To enforce good coding practice, all handle objects must implement
equals
and toString
. Please use
string
to cache the result for toString
once
calculated.
All handle objects are referred to using a single identifier. This identifier
is a instance of String
. It is important that this identifier
remain unique within whatever context that handle object is being used. For
example, there should only ever be one instance of Command
with a given identifier.
Field Summary | |
---|---|
protected boolean |
defined
Whether this object is defined. |
protected java.lang.String |
id
The identifier for this object. |
protected java.lang.String |
string
The string representation of this object. |
Constructor Summary | |
---|---|
protected |
HandleObject(java.lang.String id)
Constructs a new instance of HandleObject . |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object object)
Tests whether this object is equal to another object. |
java.lang.String |
getId()
Returns the identifier for this object. |
int |
hashCode()
Computes the hash code for this object based on the id. |
boolean |
isDefined()
Whether this instance is defined. |
abstract java.lang.String |
toString()
The string representation of this object -- for debugging purposes only. |
abstract void |
undefine()
Makes this object becomes undefined. |
Methods inherited from class org.eclipse.core.commands.common.EventManager |
---|
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected transient boolean defined
protected final java.lang.String id
null
.
protected transient java.lang.String string
Constructor Detail |
---|
protected HandleObject(java.lang.String id)
HandleObject
.
id
- The id of this handle; must not be null
.Method Detail |
---|
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- The object with which to compare; may be null
.
true
if the objects are equal; false
otherwise.public final java.lang.String getId()
IIdentifiable
getId
in interface IIdentifiable
null
.public final int hashCode()
hashCode
in class java.lang.Object
public final boolean isDefined()
true
if this object is defined; false
otherwise.public abstract java.lang.String toString()
toString
in class java.lang.Object
null
.public abstract void undefine()
null
. It should also send notification to any
listeners that these properties have changed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |