kiwi.util
Class TaggedObject

java.lang.Object
  extended bykiwi.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.
 java.lang.String toString()
          Get a string representation of the tagged object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

obj

private java.lang.Object obj

tag

private java.lang.Object tag

id

private int id
Constructor Detail

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.
Method Detail

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.

toString

public java.lang.String toString()
Get a string representation of the tagged object.

Since:
Kiwi 1.3