Methods Summary |
---|
private static java.lang.ClassLoader | getArrayClassLoader(java.lang.Object[] arr)Returns the first not null class loader for the elements of the
object array.
If element is itself an instance of the java.util.Collection or
an Array it is recursively checked for its class loader.
ClassLoader cl = null;
for (int i = 0; i < arr.length; i++) {
cl = getObjectClassLoader(arr[i]);
if (cl != null) {
break;
}
}
return cl;
|
private static java.lang.ClassLoader | getCollectionClassLoader(java.util.Collection col)Returns the class loader for the elements of the collection.
If element is itself an instance of the java.util.Collection or
an Array it is recursively checked for its class loader.
Object[] arr = col.toArray();
return getArrayClassLoader(arr);
|
private static java.lang.ClassLoader | getObjectClassLoader(java.lang.Object obj)Returns the class loader for the class of the object.
If object is an instance of the java.util.Collection or
an Array it is recursively checked for the class loader
of its elements.
Class clazz = obj.getClass();
if (obj instanceof Collection) {
return getCollectionClassLoader((Collection)obj);
} else if (clazz.isArray()) {
return getArrayClassLoader((Object[])obj);
} else {
return clazz.getClassLoader();
}
|
public static java.lang.Object | getObjectId(java.lang.Object obj)Returns a copy of the JDO identity associated with an object.
Persistent objects of PersistenceCapable classes have a JDO identity
managed by the PersistenceManager. This method returns a copy of the
ObjectId that represents the JDO identity of a persistent object.
For transient objects, 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.
if (obj instanceof PersistenceCapable)
return ((PersistenceCapable)obj).jdoGetObjectId();
return null;
|
public static PersistenceManager | getPersistenceManager(java.lang.Object obj)Returns the associated PersistenceManager of an object if there is one.
For transactional and persistent objects, their associated
PersistenceManager is returned.
For transient objects, null is returned.
if (obj instanceof PersistenceCapable)
return ((PersistenceCapable)obj).jdoGetPersistenceManager();
return null;
|
public static boolean | isDeleted(java.lang.Object obj)Tests whether the object has been deleted.
For objects that have been deleted in the current transaction,
true is returned.
For transient objects, false is returned.
if (obj instanceof PersistenceCapable)
return ((PersistenceCapable)obj).jdoIsDeleted();
return false;
|
public static boolean | isDirty(java.lang.Object obj)Tests whether an object is dirty.
If the object have been modified, deleted, or newly
made persistent in the current transaction, true is returned.
For transient objects, false is returned.
if (obj instanceof PersistenceCapable)
return ((PersistenceCapable)obj).jdoIsDirty();
return false;
|
public static boolean | isNew(java.lang.Object obj)Tests whether the object has been newly made persistent.
For objects that have been made persistent in the current transaction,
true is returned.
For transient or objects, false is returned.
if (obj instanceof PersistenceCapable)
return ((PersistenceCapable)obj).jdoIsNew();
return false;
|
public static boolean | isPersistent(java.lang.Object obj)Tests whether an object is persistent.
For objects whose state is stored in the data store, true
is returned.
For transient objects, false is returned.
if (obj instanceof PersistenceCapable)
return ((PersistenceCapable)obj).jdoIsPersistent();
return false;
|
public static boolean | isTransactional(java.lang.Object obj)Tests whether an object is transactional.
For objects that respect transaction boundaries, 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.
if (obj instanceof PersistenceCapable)
return ((PersistenceCapable)obj).jdoIsTransactional();
return false;
|
public 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.
Normally, PersistenceCapable classes are able to detect changes made
to their fields. However, if a reference to an Array is given to a
method outside the class, and the Array is modified, then the
persistent object is not aware of the change. This method allows the
application to notify the object that a change was made to a field.
For transient objects, this method does nothing.
if (obj instanceof PersistenceCapable)
((PersistenceCapable)obj).jdoMakeDirty(fieldName);
|
public static java.lang.String | printObject(java.lang.Object o)Prints the object.
If object is not NULL and is not deleted, calls toString() method
on the object.
Does not allow to access fields of the deleted object //NOI18N
if (o==null)
return null_instance;
else if (isDeleted(o))
return I18NHelper.getMessage(messages, "jdohelper.deleted_instance", //NOI18N
o.getClass().getName());
else
return o.toString();
|