|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nakedobjects.plugins.hibernate.objectstore.persistence.oidgenerator.HibernateOid
public final class HibernateOid
| Constructor Summary | |
|---|---|
HibernateOid(DataInputExtended input)
|
|
| Method Summary | |
|---|---|
void |
clearPrevious()
|
void |
copyFrom(Oid oid)
|
static HibernateOid |
createPersistent(java.lang.Class<?> clazz,
java.io.Serializable primaryKey)
Creates a new persistent instance, using the specified primaryKey. |
static HibernateOid |
createPersistent(java.lang.String className,
java.io.Serializable primaryKey)
Creates a new persistent instance, using the specified primaryKey. |
static HibernateOid |
createPersistent(java.lang.String className,
java.io.Serializable primaryKey,
java.io.Serializable hibernateId)
Creates a new persistent instance, using the specified primaryKey and (possibly different) hibernateId. |
static HibernateOid |
createTransient(java.lang.Class<?> clazz,
long id)
Create a new transient instance, creating a primaryKey from the provided id. |
static HibernateOid |
createTransient(java.lang.Class<?> clazz,
java.io.Serializable primaryKey)
Create a new transient instance, using the specified primaryKey. |
static HibernateOid |
createTransient(java.lang.String className,
long id)
Create a new transient instance, creating a primaryKey from the provided id. |
static HibernateOid |
createTransient(java.lang.String className,
java.io.Serializable primaryKey)
Create a new transient id. |
void |
encode(DataOutputExtended output)
|
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getClassName()
Used in equals(Object). |
java.io.Serializable |
getHibernateId()
The id to return to hibernate. |
Oid |
getPrevious()
The previous Oid, if any. |
java.io.Serializable |
getPrimaryKey()
Used in equals(Object). |
int |
hashCode()
|
boolean |
hasPrevious()
|
boolean |
isTransient()
|
void |
makePersistent()
Use the hibernate Id as the primary key, in the
process marking the Oid as persistent, and storing the
previous value. |
void |
setHibernateId(java.io.Serializable hibernateId)
Update the Id, and recache state. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public HibernateOid(DataInputExtended input)
throws java.io.IOException
java.io.IOException| Method Detail |
|---|
public static HibernateOid createTransient(java.lang.Class<?> clazz,
long id)
for postconditions.
public static HibernateOid createTransient(java.lang.String className,
long id)
for postconditions.
public static HibernateOid createTransient(java.lang.Class<?> clazz,
java.io.Serializable primaryKey)
for postconditions.
public static HibernateOid createTransient(java.lang.String className,
java.io.Serializable primaryKey)
The getHibernateId() will initially be null.
public static HibernateOid createPersistent(java.lang.Class<?> clazz,
java.io.Serializable primaryKey)
for postconditions.
public static HibernateOid createPersistent(java.lang.String className,
java.io.Serializable primaryKey)
The getHibernateId() will be the same as the primaryKey.
public static HibernateOid createPersistent(java.lang.String className,
java.io.Serializable primaryKey,
java.io.Serializable hibernateId)
public void encode(DataOutputExtended output)
throws java.io.IOException
encode in interface Encodablejava.io.IOExceptionpublic void copyFrom(Oid oid)
copyFrom in interface Oidpublic java.lang.String getClassName()
equals(Object).
public java.io.Serializable getPrimaryKey()
equals(Object).
Will be the same as the getHibernateId() once the Oid
has been made persistent.
public void makePersistent()
hibernate Id as the primary key, in the
process marking the Oid as persistent, and storing the
previous value.
Note 1: should be preceded by a call to setHibernateId(Serializable) to set the
hibernate Id.
Note 2: if called then the hashCode() may change; it is the caller's responsibility to manage
any Maps that the Oid might be using.
TODO: should probably combine with setHibernateId(Serializable) ??
makePersistent in interface Oidpublic java.io.Serializable getHibernateId()
Will return null if the HibernateOid has not been
made persistent.
public void setHibernateId(java.io.Serializable hibernateId)
Note: if called then the hashCode() may change; it is the caller's responsibility to manage
any Maps that the Oid might be using.
public Oid getPrevious()
Will hold this Oid in its transient form once
makePersistent() has been called. This allows
client-side code to maintain its Oid->Object maps.
getPrevious in interface Oidpublic boolean hasPrevious()
hasPrevious in interface Oidpublic void clearPrevious()
clearPrevious in interface Oidpublic boolean isTransient()
isTransient in interface Oidpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||