|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.jdo.api.persistence.support.JDOHelper
public class JDOHelper
An utility class for querying PersistenceCapable objects.
| Constructor Summary | |
|---|---|
JDOHelper()
|
|
| Method Summary | |
|---|---|
static java.lang.Object |
getObjectId(java.lang.Object obj)
Returns a copy of the JDO identity associated with an object. |
static PersistenceManager |
getPersistenceManager(java.lang.Object obj)
Returns the associated PersistenceManager of an object if there is one. |
static boolean |
isDeleted(java.lang.Object obj)
Tests whether the object has been deleted. |
static boolean |
isDirty(java.lang.Object obj)
Tests whether an object is dirty. |
static boolean |
isNew(java.lang.Object obj)
Tests whether the object has been newly made persistent. |
static boolean |
isPersistent(java.lang.Object obj)
Tests whether an object is persistent. |
static boolean |
isTransactional(java.lang.Object obj)
Tests whether an object is transactional. |
static void |
makeDirty(java.lang.Object obj,
java.lang.String fieldName)
Explicitly marks a field of an object as dirty if the object is persistent and transactional. |
static java.lang.String |
printObject(java.lang.Object o)
Prints the object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JDOHelper()
| Method Detail |
|---|
public static PersistenceManager getPersistenceManager(java.lang.Object obj)
PersistenceManager is returned.
For transient objects, null is returned.
obj - an Object
null otherwisePersistenceCapable.jdoGetPersistenceManager()
public static void makeDirty(java.lang.Object obj,
java.lang.String fieldName)
obj - an objectfieldName - the name of the object's field to be marked
dirtyPersistenceCapable.jdoMakeDirty(String fieldName)public static java.lang.Object getObjectId(java.lang.Object obj)
null is returned.
The ObjectId may be serialized and later restored, and used with a PersistenceManager from the same JDO implementation to locate a persistent object with the same data store identity. If the JDO identity is managed by the application, then the ObjectId may be used with a PersistenceManager from any JDO implementation that supports the PersistenceCapable class. If the JDO identity is not managed by the application or the data store, then the ObjectId returned is only valid within the current transaction.
obj - an Object
null if the object is transientPersistenceCapable.jdoGetObjectId(),
PersistenceManager.getObjectId(Object obj),
PersistenceManager.getObjectById(Object oid)public static boolean isDirty(java.lang.Object obj)
true is returned.
For transient objects, false is returned.
obj - an Object
true if the object has been modified
in the current transaction; false
otherwise.PersistenceCapable.jdoIsDirty(),
PersistenceCapable.jdoMakeDirty(String fieldName)public static boolean isTransactional(java.lang.Object obj)
true is
returned.
These objects include transient objects made transactional as a
result of being the target of a makeTransactional method call; newly
made persistent or deleted persistent objects; persistent objects
read in data store transactions; and persistent objects modified in
optimistic transactions.
For non-transactional objects, false is returned.
obj - an Object
true if the object is transactional;
false otherwise.PersistenceCapable.jdoIsTransactional()public static boolean isPersistent(java.lang.Object obj)
true
is returned.
For transient objects, false is returned.
obj - an Object
true if the object is persistent;
false otherwise.PersistenceCapable.jdoIsPersistent(),
PersistenceManager.makePersistent(Object obj)public static boolean isNew(java.lang.Object obj)
true is returned.
For transient or objects, false is returned.
obj - an Object
true if the object was made persistent
in the current transaction;
false otherwise.PersistenceCapable.jdoIsNew(),
PersistenceManager.makePersistent(Object obj)public static boolean isDeleted(java.lang.Object obj)
true is returned.
For transient objects, false is returned.
obj - an Object
true if the object was deleted in the
current transaction;
false otherwise.PersistenceCapable.jdoIsDeleted(),
PersistenceManager.deletePersistent(Object obj)public static java.lang.String printObject(java.lang.Object o)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||