Spring Data Commons

org.springframework.data.repository.core.support
Class PersistableEntityInformation<T extends Persistable<ID>,ID extends Serializable>

java.lang.Object
  extended by org.springframework.data.repository.core.support.AbstractEntityInformation<T,ID>
      extended by org.springframework.data.repository.core.support.PersistableEntityInformation<T,ID>
All Implemented Interfaces:
EntityInformation<T,ID>, EntityMetadata<T>

public class PersistableEntityInformation<T extends Persistable<ID>,ID extends Serializable>
extends AbstractEntityInformation<T,ID>

Implementation of EntityMetadata that assumes the entity handled implements Persistable and uses Persistable.isNew() for the AbstractEntityInformation.isNew(Object) check.

Author:
Oliver Gierke

Constructor Summary
PersistableEntityInformation(Class<T> domainClass)
          Creates a new PersistableEntityInformation.
 
Method Summary
 ID getId(T entity)
          Returns the id of the given entity.
 Class<ID> getIdType()
          Returns the type of the id of the entity.
 boolean isNew(T entity)
          Returns whether the given entity is considered to be new.
 
Methods inherited from class org.springframework.data.repository.core.support.AbstractEntityInformation
getJavaType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistableEntityInformation

public PersistableEntityInformation(Class<T> domainClass)
Creates a new PersistableEntityInformation.

Parameters:
domainClass -
Method Detail

isNew

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

Specified by:
isNew in interface EntityInformation<T extends Persistable<ID>,ID extends Serializable>
Overrides:
isNew in class AbstractEntityInformation<T extends Persistable<ID>,ID extends Serializable>
Parameters:
entity - must never be null
Returns:

getId

public ID getId(T entity)
Description copied from interface: EntityInformation
Returns the id of the given entity.

Parameters:
entity - must never be null
Returns:

getIdType

public Class<ID> getIdType()
Description copied from interface: EntityInformation
Returns the type of the id of the entity.

Returns:

Spring Data Commons

Copyright © 2012. All Rights Reserved.