Spring Data Jpa

org.springframework.data.jpa.repository.support
Class JpaMetamodelEntityInformation<T,ID extends Serializable>

java.lang.Object
  extended by org.springframework.data.repository.support.AbstractEntityInformation<T,ID>
      extended by org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation<T,ID>
All Implemented Interfaces:
JpaEntityInformation<T,ID>, org.springframework.data.repository.support.EntityInformation<T,ID>, org.springframework.data.repository.support.EntityMetadata<T>
Direct Known Subclasses:
JpaPersistableEntityInformation

public class JpaMetamodelEntityInformation<T,ID extends Serializable>
extends org.springframework.data.repository.support.AbstractEntityInformation<T,ID>
implements JpaEntityInformation<T,ID>

Implementation of EntityInformation that uses JPA Metamodel to find the domain class' id field.

Author:
Oliver Gierke

Constructor Summary
JpaMetamodelEntityInformation(Class<T> domainClass, javax.persistence.metamodel.Metamodel metamodel)
          Creates a new JpaMetamodelEntityInformation for the given domain class and Metamodel.
 
Method Summary
 ID getId(T entity)
           
 javax.persistence.metamodel.SingularAttribute<? super T,?> getIdAttribute()
          Returns the id attribute of the entity.
 Class<ID> getIdType()
           
 
Methods inherited from class org.springframework.data.repository.support.AbstractEntityInformation
getJavaType, isNew
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.data.repository.support.EntityInformation
isNew
 
Methods inherited from interface org.springframework.data.repository.support.EntityMetadata
getJavaType
 

Constructor Detail

JpaMetamodelEntityInformation

public JpaMetamodelEntityInformation(Class<T> domainClass,
                                     javax.persistence.metamodel.Metamodel metamodel)
Creates a new JpaMetamodelEntityInformation for the given domain class and Metamodel.

Parameters:
domainClass -
metamodel -
Method Detail

getId

public ID getId(T entity)
Specified by:
getId in interface org.springframework.data.repository.support.EntityInformation<T,ID extends Serializable>

getIdType

public Class<ID> getIdType()
Specified by:
getIdType in interface org.springframework.data.repository.support.EntityInformation<T,ID extends Serializable>

getIdAttribute

public javax.persistence.metamodel.SingularAttribute<? super T,?> getIdAttribute()
Description copied from interface: JpaEntityInformation
Returns the id attribute of the entity.

Specified by:
getIdAttribute in interface JpaEntityInformation<T,ID extends Serializable>
Returns:

Spring Data Jpa

Copyright © 2011 SpringSource. All Rights Reserved.