Spring Data Commmons

org.springframework.data.repository.support
Class ReflectiveEntityInformationSupport

java.lang.Object
  extended by org.springframework.data.repository.support.ReflectiveEntityInformationSupport
All Implemented Interfaces:
IdAware, IsNewAware

public class ReflectiveEntityInformationSupport
extends Object
implements IsNewAware, IdAware

IsNewAware and IdAware implementation that reflectively checks a Field or Method annotated with the given annotations. Subclasses usually simply have to provide the persistence technology specific annotations.

Author:
Oliver Gierke

Constructor Summary
ReflectiveEntityInformationSupport(Class<?> domainClass, Class<? extends Annotation>... annotationsToScanFor)
          Creates a new ReflectiveEntityInformationSupport by inspecting the given class for a Field or Method for and Id annotation.
 
Method Summary
 Object getId(Object entity)
          Returns the id of the given entity.
 boolean isNew(Object entity)
          Returns whether the given entity is considered to be new.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectiveEntityInformationSupport

public ReflectiveEntityInformationSupport(Class<?> domainClass,
                                          Class<? extends Annotation>... annotationsToScanFor)
Creates a new ReflectiveEntityInformationSupport by inspecting the given class for a Field or Method for and Id annotation.

Parameters:
domainClass - not null, must be annotated with Entity and carry an anootation defining the id property.
Method Detail

isNew

public boolean isNew(Object entity)
Description copied from interface: IsNewAware
Returns whether the given entity is considered to be new.

Specified by:
isNew in interface IsNewAware
Returns:

getId

public Object getId(Object entity)
Description copied from interface: IdAware
Returns the id of the given entity.

Specified by:
getId in interface IdAware
Returns:

Spring Data Commmons

Copyright © 2011. All Rights Reserved.