com.trg.search
Interface MetadataUtil

All Known Implementing Classes:
JPAAnnotationMetadataUtil

public interface MetadataUtil

The framework uses an implementation of this interface to introspect the objects and relationships maintained by the JPA provider. This interface provides a layer of abstraction between the framework and the underlying ORM or JPA provider (ex. Hibernate). By switching out the implementation of this interface, the framework should be able to be used with different JPA providers.

Author:
dwolverton

Method Summary
 Metadata get(java.lang.Class<?> klass)
          Get the Metadata for an entity class.
 Metadata get(java.lang.Class<?> rootEntityClass, java.lang.String propertyPath)
          Get the Metadata for a property of an entity class.
 java.io.Serializable getId(java.lang.Object object)
          Get the value of the ID property of an entity.
<T> java.lang.Class<T>
getUnproxiedClass(java.lang.Class<?> klass)
          Return the actual entity class registered with the persistence provider.
<T> java.lang.Class<T>
getUnproxiedClass(java.lang.Object entity)
          Return the actual entity class registered with the persistence provider.
 boolean isId(java.lang.Class<?> rootClass, java.lang.String propertyPath)
          Return true if the property at the given property path is the id of some entity.
 

Method Detail

getId

java.io.Serializable getId(java.lang.Object object)
Get the value of the ID property of an entity.


isId

boolean isId(java.lang.Class<?> rootClass,
             java.lang.String propertyPath)
Return true if the property at the given property path is the id of some entity.


get

Metadata get(java.lang.Class<?> klass)
Get the Metadata for an entity class.

Throws:
java.lang.IllegalArgumentException - if the class is not a Hibernate entity.

get

Metadata get(java.lang.Class<?> rootEntityClass,
             java.lang.String propertyPath)
Get the Metadata for a property of an entity class. The property can be simple ("name") or nested ("organization.name").

Throws:
java.lang.IllegalArgumentException - if the root class is not a Hibernate entity.
PropertyNotFoundException - if the class does not have the given property.

getUnproxiedClass

<T> java.lang.Class<T> getUnproxiedClass(java.lang.Class<?> klass)
Return the actual entity class registered with the persistence provider. This may be the same class or it may be different if the given class is is a proxy. For example, the entity class may be Person, but the class of the proxy may be Person_$$_javassist_5. We need to normalize this to Person so that we can create correct queries and inspect metadata correctly.


getUnproxiedClass

<T> java.lang.Class<T> getUnproxiedClass(java.lang.Object entity)
Return the actual entity class registered with the persistence provider. This may be the same as entity.getClass() or it may be different if the object is is a proxy. For example, the entity class may be Person, but the class of the proxy object may be Person_$$_javassist_5. We need to normalize this to Person so that we can create correct queries and inspect metadata correctly.



Copyright © 2008-2010 eBM WebSourcing. All Rights Reserved.