public final class EntityHelper extends Object
| Constructor and Description |
|---|
EntityHelper() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends Model> |
equals(T entity,
Object other)
The equals helper method.
|
static <T> T |
getEntity(T entity)
Get unproxied instance of the given entity.
|
static <T> Class<T> |
getEntityClass(T entity)
Get the real persistence class of the given entity.
|
static <T extends Model> |
hashCode(T entity)
The hashCode helper method.
|
static <T> boolean |
isUninitialized(T entity)
Check whether the given lazy loading proxy instance is uninitialized.
|
static <T extends Model> |
toString(T entity)
The toString helper method.
|
public static <T extends Model> String toString(T entity)
T - type of the entityentity - generate toString for the given entitypublic static <T extends Model> int hashCode(T entity)
This method searches for all the fields marked with HashKey and uses them to
generate the hash code.
T - type of the entityentity - generate the hashCode for the given entitypublic static <T extends Model> boolean equals(T entity, Object other)
This method searches for all the fields marked with HashKey and uses them to check
for the equality.
T - type of the entityentity - the current entityother - the other entitypublic static <T> Class<T> getEntityClass(T entity)
This method can be used to find real class name of a proxy object returned by hibernate
entity manager or Context.asType(Class) instance.
T - type of the entityentity - an entity instancepublic static <T> T getEntity(T entity)
This method can be used to convert hibernate proxy object to real implementation instance.
If called for instances returned with Context.asType(Class), it returns partial
context instance.
T - type of the entityentity - proxied entitypublic static <T> boolean isUninitialized(T entity)
T - type of the entityentity - the lazy loading entity instance