| java.lang.Object org.apache.ojb.broker.Identity
Identity | public class Identity implements Serializable(Code) | | Represents the identity of an object.
It's composed of:
-
class of the real object
-
top-level class of the real object (could be an abstract class or interface or the
class of the object itself), used to make an object unique across extent classes
-
an array of all primary key value objects
-
a flag which indicates whether this is a transient Identity
(identity of a non-persistent, "new" object) or a persistent Identity (identity object
of a persistent, "already written to datastore" object).
To create Identity objects it's strongly recommended to use the
IdentityFactory , because
in future releases of OJB the Identity constructors will be no longer reachable or forbidden to use.
NOTE: An Identity object must be unique
accross extents. Means all objects with the same top-level class need unique
PK values.
See Also: org.apache.ojb.broker.IdentityFactory author: Thomas Mahler version: $Id: Identity.java,v 1.36.2.14 2005/12/21 22:22:07 tomdz Exp $ |
Method Summary | |
protected void | checkForPrimaryKeys(Object realObject) OJB can handle only classes that declare at least one primary key attribute,
this method checks this condition. | public boolean | equals(Object obj) | public static Identity | fromByteArray(byte[] anArray) Factory method that returns an Identity object created from a serializated representation. | public Class | getObjectsRealClass() Return the "real" class of the real subject. | public Class | getObjectsTopLevelClass() Returns the top-level class of the real subject (base class,
base interface denoted in the repository or
objects real class if no top-level was found). | public Object[] | getPrimaryKeyValues() Returns the primary key values of the real subject. | public int | hashCode() | public boolean | isTransient() Determines whether the identity is transient. | public byte[] | serialize() Return the serialized form of this Identity. | public void | setObjectsRealClass(Class objectsRealClass) Set the real class of the subject. | public String | toString() return a String representation. |
Identity | protected Identity()(Code) | | For internal use only!
|
Identity | public Identity(Class realClass, Class topLevel, Object[] pkValues, boolean isTransient)(Code) | | For internal use only!. Creates an em from a class and the objects primary key values.
used for the definition of proxies.
OJB user have to use
IdentityFactory to create object identity.
Parameters: realClass - the concrete class of the object, or null if not known. Parameters: topLevel - the highest persistence-capable class orinterface (in the inheritance hierarchy) that the identified object is an instance of Parameters: pkValues - (unique across the extents !) Parameters: isTransient - If true |
Identity | public Identity(Class realClass, Class topLevel, Object[] pkValues)(Code) | | For internal use only! Creates an Identity from a class and the objects primary key values.
used for the definition of proxies.
OJB user have to use
IdentityFactory to create object identity.
Parameters: realClass - the concrete class of the object, or null if not known. Parameters: topLevel - the highest persistence-capable class orinterface (in the inheritance hierarchy) that the identified object is an instance of Parameters: pkValues - (unique across the extents !) |
Identity | public Identity(Object objectToIdentitify, PersistenceBroker targetBroker)(Code) | | Constructor for internal use. Use
IdentityFactory to create an object identity.
Parameters: objectToIdentitify - The object for which to create the identity Parameters: targetBroker - The persistence broker |
Identity | public Identity(Object objectToIdentitify, PersistenceBroker targetBroker, ClassDescriptor cld)(Code) | | Constructor for internal use. Use
IdentityFactory to create an object identity.
Parameters: objectToIdentitify - The object for which to create the identity Parameters: targetBroker - The persistence broker Parameters: cld - The class descriptor |
fromByteArray | public static Identity fromByteArray(byte[] anArray) throws PersistenceBrokerException(Code) | | Factory method that returns an Identity object created from a serializated representation.
Parameters: anArray - The serialized representation The identity See Also: Identity.serialize See Also: . |
getObjectsRealClass | public Class getObjectsRealClass()(Code) | | Return the "real" class of the real subject.
The real class |
getObjectsTopLevelClass | public Class getObjectsTopLevelClass()(Code) | | Returns the top-level class of the real subject (base class,
base interface denoted in the repository or
objects real class if no top-level was found).
The top level class |
getPrimaryKeyValues | public Object[] getPrimaryKeyValues()(Code) | | Returns the primary key values of the real subject.
The pk values |
hashCode | public int hashCode()(Code) | | |
isTransient | public boolean isTransient()(Code) | | Determines whether the identity is transient.
true if the identity is transient |
setObjectsRealClass | public void setObjectsRealClass(Class objectsRealClass)(Code) | | Set the real class of the subject.
Parameters: objectsRealClass - The real class |
toString | public String toString()(Code) | | return a String representation.
java.lang.String |
|
|