Spring Data Commons

org.springframework.data.mapping
Interface PersistentEntity<T,P extends PersistentProperty<P>>

All Known Subinterfaces:
MutablePersistentEntity<T,P>
All Known Implementing Classes:
BasicPersistentEntity

public interface PersistentEntity<T,P extends PersistentProperty<P>>

Represents a persistent entity

Author:
Graeme Rocher, Jon Brisbin, Oliver Gierke

Method Summary
 void doWithAssociations(AssociationHandler<P> handler)
          Applies the given AssociationHandler to all Association contained in this PersistentEntity.
 void doWithProperties(PropertyHandler<P> handler)
          Applies the given PropertyHandler to all PersistentPropertys contained in this PersistentEntity.
 P getIdProperty()
          Returns the id property of the PersistentEntity.
 String getName()
          The entity name including any package prefix
 P getPersistentProperty(String name)
          Obtains a PersistentProperty instance by name.
 PreferredConstructor<T> getPreferredConstructor()
          Returns the PreferredConstructor to be used to instantiate objects of this PersistentEntity.
 Class<T> getType()
          Returns the resolved Java type of this entity.
 TypeInformation<T> getTypeInformation()
          Returns the TypeInformation backing this PersistentEntity.
 

Method Detail

getName

String getName()
The entity name including any package prefix

Returns:
must never return null

getPreferredConstructor

PreferredConstructor<T> getPreferredConstructor()
Returns the PreferredConstructor to be used to instantiate objects of this PersistentEntity.

Returns:
must never return null.

getIdProperty

P getIdProperty()
Returns the id property of the PersistentEntity. Must never return null as a PersistentEntity instance must not be created if there is no id property.

Returns:
the id property of the PersistentEntity.

getPersistentProperty

P getPersistentProperty(String name)
Obtains a PersistentProperty instance by name.

Parameters:
name - The name of the property
Returns:
The PersistentProperty or null if it doesn't exist

getType

Class<T> getType()
Returns the resolved Java type of this entity.

Returns:
The underlying Java class for this entity

getTypeInformation

TypeInformation<T> getTypeInformation()
Returns the TypeInformation backing this PersistentEntity.

Returns:

doWithProperties

void doWithProperties(PropertyHandler<P> handler)
Applies the given PropertyHandler to all PersistentPropertys contained in this PersistentEntity.

Parameters:
handler - must not be null.

doWithAssociations

void doWithAssociations(AssociationHandler<P> handler)
Applies the given AssociationHandler to all Association contained in this PersistentEntity.

Parameters:
handler - must not be null.

Spring Data Commons

Copyright © 2011. All Rights Reserved.