Spring Data Commons

org.springframework.data.mapping
Class BasicPersistentEntity<T>

java.lang.Object
  extended by org.springframework.data.mapping.BasicPersistentEntity<T>
All Implemented Interfaces:
InitializingBean, PersistentEntity<T>

public class BasicPersistentEntity<T>
extends Object
implements PersistentEntity<T>

Author:
Jon Brisbin

Field Summary
protected  Map<String,Association> associations
           
protected  PersistentProperty idProperty
           
protected  TypeInformation information
           
protected  MappingContext mappingContext
           
protected  Map<String,PersistentProperty> persistentProperties
           
protected  PreferredConstructor<T> preferredConstructor
           
protected  Class<T> type
           
 
Constructor Summary
BasicPersistentEntity(MappingContext mappingContext, TypeInformation information)
           
 
Method Summary
 void addAssociation(Association association)
           
 void addPersistentProperty(PersistentProperty property)
           
 void afterPropertiesSet()
           
 void doWithAssociations(AssociationHandler handler)
           
 void doWithProperties(PropertyHandler handler)
           
 Collection<Association> getAssociations()
          A list of the associations for this entity.
 PersistentProperty getIdProperty()
          Returns the identity of the instance
 MappingContext getMappingContext()
          Obtains the MappingContext where this PersistentEntity is defined
 String getName()
          The entity name including any package prefix
 Collection<PersistentProperty> getPersistentProperties()
          A list of properties to be persisted
 PersistentProperty getPersistentProperty(String name)
          Obtains a PersistentProperty instance by name
 Collection<String> getPersistentPropertyNames()
          A list of property names
 PreferredConstructor<T> getPreferredConstructor()
           
 TypeInformation getPropertyInformation()
           
 Class<T> getType()
           
 void setIdProperty(PersistentProperty property)
           
 void setPreferredConstructor(PreferredConstructor<T> constructor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected final Class<T> type

preferredConstructor

protected PreferredConstructor<T> preferredConstructor

idProperty

protected PersistentProperty idProperty

persistentProperties

protected Map<String,PersistentProperty> persistentProperties

associations

protected Map<String,Association> associations

information

protected final TypeInformation information

mappingContext

protected MappingContext mappingContext
Constructor Detail

BasicPersistentEntity

public BasicPersistentEntity(MappingContext mappingContext,
                             TypeInformation information)
Method Detail

getPreferredConstructor

public PreferredConstructor<T> getPreferredConstructor()
Specified by:
getPreferredConstructor in interface PersistentEntity<T>

setPreferredConstructor

public void setPreferredConstructor(PreferredConstructor<T> constructor)

getName

public String getName()
Description copied from interface: PersistentEntity
The entity name including any package prefix

Specified by:
getName in interface PersistentEntity<T>
Returns:
The entity name

getIdProperty

public PersistentProperty getIdProperty()
Description copied from interface: PersistentEntity
Returns the identity of the instance

Specified by:
getIdProperty in interface PersistentEntity<T>
Returns:
The identity

setIdProperty

public void setIdProperty(PersistentProperty property)

getPersistentProperties

public Collection<PersistentProperty> getPersistentProperties()
Description copied from interface: PersistentEntity
A list of properties to be persisted

Specified by:
getPersistentProperties in interface PersistentEntity<T>
Returns:
A list of PersistentProperty instances

addPersistentProperty

public void addPersistentProperty(PersistentProperty property)

getAssociations

public Collection<Association> getAssociations()
Description copied from interface: PersistentEntity
A list of the associations for this entity. This is typically a subset of the list returned by PersistentEntity.getPersistentProperties()

Specified by:
getAssociations in interface PersistentEntity<T>
Returns:
A list of associations

addAssociation

public void addAssociation(Association association)

getPersistentProperty

public PersistentProperty getPersistentProperty(String name)
Description copied from interface: PersistentEntity
Obtains a PersistentProperty instance by name

Specified by:
getPersistentProperty in interface PersistentEntity<T>
Parameters:
name - The name of the property
Returns:
The PersistentProperty or null if it doesn't exist

getType

public Class<T> getType()
Specified by:
getType in interface PersistentEntity<T>
Returns:
The underlying Java class for this entity

getPropertyInformation

public TypeInformation getPropertyInformation()
Specified by:
getPropertyInformation in interface PersistentEntity<T>

getPersistentPropertyNames

public Collection<String> getPersistentPropertyNames()
Description copied from interface: PersistentEntity
A list of property names

Specified by:
getPersistentPropertyNames in interface PersistentEntity<T>
Returns:
A List of strings

getMappingContext

public MappingContext getMappingContext()
Description copied from interface: PersistentEntity
Obtains the MappingContext where this PersistentEntity is defined

Specified by:
getMappingContext in interface PersistentEntity<T>
Returns:
The MappingContext instance

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

doWithProperties

public void doWithProperties(PropertyHandler handler)
Specified by:
doWithProperties in interface PersistentEntity<T>

doWithAssociations

public void doWithAssociations(AssociationHandler handler)
Specified by:
doWithAssociations in interface PersistentEntity<T>

Spring Data Commons

Copyright © 2011. All Rights Reserved.