public class DomainUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
equalsLockFlag(Serializable flag1,
Serializable flag2)
Return true if two lockFlags are equal
|
static <T,U extends T> |
getDomainClass(Class<U> clazz)
Get the "true" domain class for a given class, i.e.
|
static <T,U extends T> |
getDomainClass(U domainObject)
Get the "true" domain class for a given domainObject, i.e.
|
static <T,U extends T> |
getDomainSuperClass(Class<U> clazz)
Get the domain super class for the given class, or
null if
no such class exists. |
static Serializable |
getLockFlag(Object domainObject)
Gets the lock flag property of the domain object.
|
static boolean |
hasLockFlag(Object domainObject)
Test whether an object has a "lockFlag" field or not.
|
static boolean |
isLazy(Object o)
Checks if the object in question is not initialized.
|
static boolean |
isLazy(Set<? extends Object> s)
Checks if the Set in question contains un-initialized lazy objects.
|
static void |
setLockFlag(Object domainObject,
Serializable lockFlag)
Sets the lock flag property on the domain object.
|
static <T,U extends T> |
strip(U domainObject,
Class<T> domainClass,
Set<String> ignore)
Strips the specified domain object.
|
static void |
stripRecursive(Object domainObject,
Object parent)
Strips the specified domain object recursively, i.e.
|
public static <T,U extends T> Class<T> getDomainClass(U domainObject)
T - The domain object (super) classU - The domain object type.domainObject - The domain object to get the class frompublic static <T,U extends T> Class<T> getDomainClass(Class<U> clazz)
T - The domain object super class.U - The domain object class (possibly hibernate proxy).clazz - The domain object classpublic static <T,U extends T> Class<T> getDomainSuperClass(Class<U> clazz)
null if
no such class exists.T - The domain object super classU - The domain object classclazz - The domain object classnull if the super class is an Object.public static boolean hasLockFlag(Object domainObject)
domainObject - the object to testpublic static Serializable getLockFlag(Object domainObject)
null is returned.
Gets the lock flag property of the domain object. If the domain object
does not have a lock flag, null is returned.domainObject - (missing javadoc)public static void setLockFlag(Object domainObject, Serializable lockFlag)
domainObject - (missing javadoc)lockFlag - (missing javadoc)public static boolean equalsLockFlag(Serializable flag1, Serializable flag2)
flag1 - (missing javadoc)flag2 - (missing javadoc)public static boolean isLazy(Object o)
o - the object to checktrue if the object is not initialized.public static boolean isLazy(Set<? extends Object> s)
s - the Set to checktrue if the set contains un-initialized objects.public static <T,U extends T> U strip(U domainObject,
Class<T> domainClass,
Set<String> ignore)
getFoo()) and tested for the following conditions:
PersistentClass.
null
(again using reflection and a bean-style set-method, e.g.
setFoo(null).
Note:All exceptions that are caught as part of the reflective access to the domain object are wrapped in a G9BaseException and re-thrown.
T - The domain object (super) classU - The domain object typedomainObject - the domain object to stripdomainClass - the declared domain object classignore - the set of relation-names to ignore when stripping.public static void stripRecursive(Object domainObject, Object parent)
getFoo()) and tested for the
following condition:
PersistentClass.
null (again using reflection and a bean-style
set-method, e.g. setFoo(null).
Note:All exceptions except those mentioned above that are caught as part of the reflective access to the domain object are wrapped in a G9BaseException and re-thrown.
domainObject - - the object to strip recursivelyparent - - the parent object, avoided when traversing the object graph
recursivelyCopyright © 2006–2020 Esito AS. All rights reserved.