Package org.apache.openjpa.util
Class OpenJPAId
- java.lang.Object
-
- org.apache.openjpa.util.OpenJPAId
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable
- Direct Known Subclasses:
BigDecimalId,BigIntegerId,BooleanId,ByteId,CharId,DateId,DoubleId,FloatId,Id,IntId,LongId,ObjectId,ShortId,StringId
public abstract class OpenJPAId extends java.lang.Object implements java.lang.Comparable, java.io.SerializableIdentity class extended by built-in OpenJPA identity objects.- Author:
- Steve Kim
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleansubsprotected java.lang.Classtypestatic charTYPE_VALUE_SEP
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.lang.Object other)booleanequals(java.lang.Object o)abstract java.lang.ObjectgetIdObject()Return the identity value as an object.java.lang.ClassgetType()Return the persistent class which this id instance represents.inthashCode()Generate the hash code for this Id.booleanhasSubclasses()Whether this oid might be for a subclass of the given type.protected abstract booleanidEquals(OpenJPAId other)Compare the id to the id of the given instance.protected abstract intidHash()Return the id's hash code.voidsetManagedInstanceType(java.lang.Class type)Set the exact type of the described instance once it is known.voidsetManagedInstanceType(java.lang.Class type, boolean subs)Set the exact type of the described instance once it is known.java.lang.StringtoString()
-
-
-
Field Detail
-
TYPE_VALUE_SEP
public static final char TYPE_VALUE_SEP
- See Also:
- Constant Field Values
-
type
protected java.lang.Class type
-
subs
protected boolean subs
-
-
Method Detail
-
getType
public java.lang.Class getType()
Return the persistent class which this id instance represents.
-
hasSubclasses
public boolean hasSubclasses()
Whether this oid might be for a subclass of the given type. Defaults to true.
-
setManagedInstanceType
public void setManagedInstanceType(java.lang.Class type)
Set the exact type of the described instance once it is known.
-
setManagedInstanceType
public void setManagedInstanceType(java.lang.Class type, boolean subs)Set the exact type of the described instance once it is known.
-
getIdObject
public abstract java.lang.Object getIdObject()
Return the identity value as an object.
-
idHash
protected abstract int idHash()
Return the id's hash code.
-
idEquals
protected abstract boolean idEquals(OpenJPAId other)
Compare the id to the id of the given instance.
-
hashCode
public int hashCode()
Generate the hash code for this Id. Cache the type's generated hash code so that it doesn't have to be generated each time.- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(java.lang.Object other)
- Specified by:
compareToin interfacejava.lang.Comparable
-
-