org.apache.openjpa.util
Class Id

java.lang.Object
  extended by org.apache.openjpa.util.OpenJPAId
      extended by org.apache.openjpa.util.Id
All Implemented Interfaces:
Serializable, Comparable

public final class Id
extends OpenJPAId

Datastore identity type. Implementations may choose to use this type, or choose to use their own datastore identity values.

Author:
Abe White
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.openjpa.util.OpenJPAId
subs, type
 
Constructor Summary
Id(Class cls, long key)
          Construct from key value.
Id(Class cls, Long key)
          Construct from key value.
Id(Class cls, long key, boolean subs)
          Construct from key value.
Id(Class cls, String key)
          Construct from the result of a OpenJPAId.toString() call on another instance.
Id(String str)
          Create an id from the result of a OpenJPAId.toString() call on another instance.
Id(String str, ClassLoader loader)
          Create an id from the result of an OpenJPAId.toString() call on another instance.
Id(String str, OpenJPAConfiguration conf, ClassLoader brokerLoader)
          Create an id from the result of an OpenJPAId.toString() call on another instance.
 
Method Summary
 long getId()
          Primary key.
 Object getIdObject()
          Return the identity value as an object.
protected  boolean idEquals(OpenJPAId other)
          Compare the id to the id of the given instance.
protected  int idHash()
          Return the id's hash code.
static Id newInstance(Class cls, Object val)
          Create an id from the given type and value; the value might be an id instnace, a stringified id, or a primary key value.
 
Methods inherited from class org.apache.openjpa.util.OpenJPAId
compareTo, equals, getType, hashCode, hasSubclasses, setManagedInstanceType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Id

public Id(String str)
Create an id from the result of a OpenJPAId.toString() call on another instance.


Id

public Id(String str,
          OpenJPAConfiguration conf,
          ClassLoader brokerLoader)
Create an id from the result of an OpenJPAId.toString() call on another instance.


Id

public Id(String str,
          ClassLoader loader)
Create an id from the result of an OpenJPAId.toString() call on another instance.


Id

public Id(Class cls,
          String key)
Construct from the result of a OpenJPAId.toString() call on another instance.


Id

public Id(Class cls,
          Long key)
Construct from key value.


Id

public Id(Class cls,
          long key)
Construct from key value.


Id

public Id(Class cls,
          long key,
          boolean subs)
Construct from key value.

Method Detail

newInstance

public static Id newInstance(Class cls,
                             Object val)
Create an id from the given type and value; the value might be an id instnace, a stringified id, or a primary key value.


getId

public long getId()
Primary key.


getIdObject

public Object getIdObject()
Description copied from class: OpenJPAId
Return the identity value as an object.

Specified by:
getIdObject in class OpenJPAId

idHash

protected int idHash()
Description copied from class: OpenJPAId
Return the id's hash code.

Specified by:
idHash in class OpenJPAId

idEquals

protected boolean idEquals(OpenJPAId other)
Description copied from class: OpenJPAId
Compare the id to the id of the given instance.

Specified by:
idEquals in class OpenJPAId


Copyright © 2006 Apache Software Foundation. All Rights Reserved.