kiwi.util
Class TaggedObject
java.lang.Object
|
+--kiwi.util.TaggedObject
- public class TaggedObject
- extends java.lang.Object
An object-id or object-tag pair. Sometimes it is useful to assign a tag
or numeric ID to an object for purposes of identification. Most commonly
the identifier is a unique integer, but in some circumstances it is more
appropriate to use another object as an identifier. This class allows
an object to be associated with either an integer or an arbitrary object.
- Author:
- Mark Lindner, PING Software Group
Field Summary |
private int |
id
|
private java.lang.Object |
obj
|
private java.lang.Object |
tag
|
Constructor Summary |
TaggedObject(java.lang.Object obj,
int id)
Construct a new TaggedObject for the given user object
and numerical ID. |
TaggedObject(java.lang.Object obj,
java.lang.Object tag)
Construct a new TaggedObject for the given user object
and identifier object. |
Method Summary |
int |
getID()
Get the numerical ID. |
java.lang.Object |
getObject()
Get the user object. |
java.lang.Object |
getTag()
Get the identifier object. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
obj
private java.lang.Object obj
tag
private java.lang.Object tag
id
private int id
TaggedObject
public TaggedObject(java.lang.Object obj,
java.lang.Object tag)
- Construct a new
TaggedObject
for the given user object
and identifier object.
- Parameters:
obj
- The user object.tag
- The identifier object.
TaggedObject
public TaggedObject(java.lang.Object obj,
int id)
- Construct a new
TaggedObject
for the given user object
and numerical ID.
- Parameters:
obj
- The user object.id
- The numerical ID.
getObject
public final java.lang.Object getObject()
- Get the user object.
- Returns:
- The user object.
getID
public final int getID()
- Get the numerical ID.
- Returns:
- The numerical ID, or -1 if there is no numerical ID for this
object.
getTag
public final java.lang.Object getTag()
- Get the identifier object.
- Returns:
- The identifier object, or null if there is no identifier
object for this object.