Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.virtuosotechnologies.lib.base
Class UniqueObject  view UniqueObject download UniqueObject.java

java.lang.Object
  extended bycom.virtuosotechnologies.lib.base.UniqueObject
Direct Known Subclasses:
BasicEnumeratedType, UniqueClassConstrainedKey

public class UniqueObject
extends java.lang.Object

An object whose equals() method is guaranteed to use reference equality. That is it does not equal any other object.

The description string is used for toString(). If you pass null for the description or do not provide one, UniqueObject will automatically generate a default string.


Field Summary
private  java.lang.String description_
           
private  long id_
           
private static long idCounter_
           
 
Constructor Summary
UniqueObject()
          Default constructor with no description.
UniqueObject(java.lang.String description)
          Construct a UniqueObject with a description
 
Method Summary
 boolean equals(java.lang.Object obj)
          Equals method.
 long getUniqueObjectID()
          Return a unique ID for this unique object.
 java.lang.String toString()
          Return string description.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

idCounter_

private static long idCounter_

description_

private java.lang.String description_

id_

private long id_
Constructor Detail

UniqueObject

public UniqueObject()
Default constructor with no description. Causes toString() to return an automatically-generated default description string.


UniqueObject

public UniqueObject(java.lang.String description)
Construct a UniqueObject with a description

Method Detail

getUniqueObjectID

public final long getUniqueObjectID()
Return a unique ID for this unique object. Final.


toString

public final java.lang.String toString()
Return string description. Final so it cannot be overridden.


equals

public final boolean equals(java.lang.Object obj)
Equals method. We make this final so it cannot be overridden, to enforce the contract that all UniqueObjects use reference equality.