public class Identity
extends java.lang.Object
implements java.io.Serializable
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.
IdentityFactory
,
Serialized FormConstructor and Description |
---|
Identity(java.lang.Class realClass,
java.lang.Class topLevel,
java.lang.Object[] pkValues)
For internal use only! Creates an Identity from a class and the objects primary key values.
|
Identity(java.lang.Class realClass,
java.lang.Class topLevel,
java.lang.Object[] pkValues,
boolean isTransient)
For internal use only!.
|
Identity(java.lang.Object objectToIdentitify,
PersistenceBroker targetBroker)
Constructor for internal use.
|
Identity(java.lang.Object objectToIdentitify,
PersistenceBroker targetBroker,
ClassDescriptor cld)
Constructor for internal use.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
static Identity |
fromByteArray(byte[] anArray)
Deprecated.
|
java.lang.Class |
getObjectsRealClass()
Return the "real" class of the real subject.
|
java.lang.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).
|
java.lang.Object[] |
getPrimaryKeyValues()
Returns the primary key values of the real subject.
|
int |
hashCode() |
boolean |
isTransient()
Determines whether the identity is transient.
|
byte[] |
serialize()
Deprecated.
|
void |
setObjectsRealClass(java.lang.Class objectsRealClass)
Set the real class of the subject.
|
java.lang.String |
toString()
return a String representation.
|
public Identity(java.lang.Class realClass, java.lang.Class topLevel, java.lang.Object[] pkValues, boolean isTransient)
IdentityFactory
to create object identity.realClass
- the concrete class of the object, or null if not known.topLevel
- the highest persistence-capable class or
interface (in the inheritance hierarchy) that the identified object is an instance ofpkValues
- (unique across the extents !)isTransient
- If truepublic Identity(java.lang.Class realClass, java.lang.Class topLevel, java.lang.Object[] pkValues)
IdentityFactory
to create object identity.realClass
- the concrete class of the object, or null if not known.topLevel
- the highest persistence-capable class or
interface (in the inheritance hierarchy) that the identified object is an instance ofpkValues
- (unique across the extents !)public Identity(java.lang.Object objectToIdentitify, PersistenceBroker targetBroker)
IdentityFactory
to create an object identity.objectToIdentitify
- The object for which to create the identitytargetBroker
- The persistence brokerpublic Identity(java.lang.Object objectToIdentitify, PersistenceBroker targetBroker, ClassDescriptor cld)
IdentityFactory
to create an object identity.objectToIdentitify
- The object for which to create the identitytargetBroker
- The persistence brokercld
- The class descriptorpublic static Identity fromByteArray(byte[] anArray) throws PersistenceBrokerException
anArray
- The serialized representationPersistenceBrokerException
#serialize}.
public boolean isTransient()
true
if the identity is transientpublic java.lang.Class getObjectsTopLevelClass()
public java.lang.Class getObjectsRealClass()
public void setObjectsRealClass(java.lang.Class objectsRealClass)
objectsRealClass
- The real classpublic byte[] serialize() throws PersistenceBrokerException
PersistenceBrokerException
fromByteArray(byte[])
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object[] getPrimaryKeyValues()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
(C) 2002 - 2005 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30