Spring Data Commons

org.springframework.data.mapping.model
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)
           
 void doWithProperties(PropertyHandler<P> handler)
           
 Collection<Association<P>> getAssociations()
          A list of the associations for this entity.
 P getIdProperty()
          Returns the id property of the PersistentEntity.
 String getName()
          The entity name including any package prefix
 Collection<P> getPersistentProperties()
          A list of properties to be persisted
 P getPersistentProperty(String name)
          Obtains a PersistentProperty instance by name
 Collection<String> getPersistentPropertyNames()
          A list of property names
 PreferredConstructor<T> getPreferredConstructor()
           
 Class<T> getType()
           
 TypeInformation<T> getTypeInformation()
           
 

Method Detail

getName

String getName()
The entity name including any package prefix

Returns:
The entity name

getPreferredConstructor

PreferredConstructor<T> getPreferredConstructor()

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.

getPersistentProperties

Collection<P> getPersistentProperties()
A list of properties to be persisted

Returns:
A list of PersistentProperty instances

getAssociations

Collection<Association<P>> getAssociations()
A list of the associations for this entity. This is typically a subset of the list returned by getPersistentProperties()

Returns:
A list of associations

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 underlying Java class for this entity

getTypeInformation

TypeInformation<T> getTypeInformation()

getPersistentPropertyNames

Collection<String> getPersistentPropertyNames()
A list of property names

Returns:
A List of strings

doWithProperties

void doWithProperties(PropertyHandler<P> handler)

doWithAssociations

void doWithAssociations(AssociationHandler<P> handler)

Spring Data Commons

Copyright © 2011. All Rights Reserved.