com.trg.search
Interface Metadata

All Known Implementing Classes:
JPAAnnotationCollectionMetadata, JPAAnnotationMetadata

public interface Metadata

This interface provides meta data for a single persistable type. Use MetadataUtil.get(Class) or MetadataUtil.get(Class, String) to get meta data instances. This interface provides a layer of abstraction between the framework and the underlying 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
 java.lang.Class<?> getCollectionClass()
          If the type is a collection, return the Java class of the collection itself, not the Java class of it's elements as with getJavaClass().
 java.lang.String getIdProperty()
          Return the name of the id property of this type.
 Metadata getIdType()
          Return the metadata for the id property of this type.
 java.io.Serializable getIdValue(java.lang.Object object)
          Return the value of the id property of the given object of this type.
 java.lang.Class<?> getJavaClass()
          Return the Java class of this type.
 java.lang.String[] getProperties()
          Return an array of the names of all the properties that this type has, if any.
 Metadata getPropertyType(java.lang.String property)
          Return the metadata for the given property of this type.
 java.lang.Object getPropertyValue(java.lang.Object object, java.lang.String property)
          Return the value of the given property of the given object of this type.
 boolean isCollection()
          Return true if the type is a collection.
 boolean isEmeddable()
          Return true if the type is an embeddable class (a component class in Hibernate).
 boolean isEntity()
          Return true if the type is an entity.
 boolean isNumeric()
          Return true if the type is a number.
 boolean isString()
          Return true if the type is persisted as a string (char or varchar) type in the database.
 

Method Detail

isEntity

boolean isEntity()
Return true if the type is an entity.


isEmeddable

boolean isEmeddable()
Return true if the type is an embeddable class (a component class in Hibernate).


isCollection

boolean isCollection()
Return true if the type is a collection.


isString

boolean isString()
Return true if the type is persisted as a string (char or varchar) type in the database.


isNumeric

boolean isNumeric()
Return true if the type is a number. For example: int, Float, Number, double, etc.


getJavaClass

java.lang.Class<?> getJavaClass()
Return the Java class of this type. If the type is a collection, return the type of the collection elements.


getProperties

java.lang.String[] getProperties()
Return an array of the names of all the properties that this type has, if any. Return null if this a simple value type with no properties.


getPropertyValue

java.lang.Object getPropertyValue(java.lang.Object object,
                                  java.lang.String property)
Return the value of the given property of the given object of this type. Return null if this a simple value type with no properties.


getPropertyType

Metadata getPropertyType(java.lang.String property)
Return the metadata for the given property of this type. Return null if this a simple value type with no properties.


getIdProperty

java.lang.String getIdProperty()
Return the name of the id property of this type. Return null if this is not an entity type.


getIdType

Metadata getIdType()
Return the metadata for the id property of this type. Return null if this is not an entity type.


getIdValue

java.io.Serializable getIdValue(java.lang.Object object)
Return the value of the id property of the given object of this type. Return null if this is not an entity type.


getCollectionClass

java.lang.Class<?> getCollectionClass()
If the type is a collection, return the Java class of the collection itself, not the Java class of it's elements as with getJavaClass(). For example: ArrayList<Project>, Set<Person>, String[].



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