Spring Data Document

org.springframework.data.mongodb.core.mapping
Class BasicMongoPersistentEntity<T>

java.lang.Object
  extended by org.springframework.data.mapping.model.BasicPersistentEntity<T,MongoPersistentProperty>
      extended by org.springframework.data.mongodb.core.mapping.BasicMongoPersistentEntity<T>
All Implemented Interfaces:
Aware, ApplicationContextAware, org.springframework.data.mapping.model.MutablePersistentEntity<T,MongoPersistentProperty>, org.springframework.data.mapping.PersistentEntity<T,MongoPersistentProperty>, MongoPersistentEntity<T>

public class BasicMongoPersistentEntity<T>
extends org.springframework.data.mapping.model.BasicPersistentEntity<T,MongoPersistentProperty>
implements MongoPersistentEntity<T>, ApplicationContextAware

MongoDB specific MongoPersistentEntity implementation that adds Mongo specific meta-data such as the collection name and the like.

Author:
Jon Brisbin, Oliver Gierke, Patryk Wasik

Constructor Summary
BasicMongoPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
          Creates a new BasicMongoPersistentEntity with the given TypeInformation.
 
Method Summary
 void addPersistentProperty(MongoPersistentProperty property)
           
 String getCollection()
          Returns the collection the entity shall be persisted to.
 MongoPersistentProperty getVersionProperty()
          Returns the MongoPersistentProperty that represents the version attribute of an entity.
 boolean hasVersionProperty()
          Returns whether the entity has a property representing the version of the entity.
 void setApplicationContext(ApplicationContext applicationContext)
           
 
Methods inherited from class org.springframework.data.mapping.model.BasicPersistentEntity
addAssociation, doWithAssociations, doWithProperties, getIdProperty, getName, getPersistenceConstructor, getPersistentProperty, getType, getTypeAlias, getTypeInformation, isConstructorArgument, isIdProperty, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.data.mapping.PersistentEntity
doWithAssociations, doWithProperties, getIdProperty, getName, getPersistenceConstructor, getPersistentProperty, getType, getTypeAlias, getTypeInformation, isConstructorArgument, isIdProperty
 

Constructor Detail

BasicMongoPersistentEntity

public BasicMongoPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
Creates a new BasicMongoPersistentEntity with the given TypeInformation. Will default the collection name to the entities simple type name.

Parameters:
typeInformation -
Method Detail

addPersistentProperty

public void addPersistentProperty(MongoPersistentProperty property)
Specified by:
addPersistentProperty in interface org.springframework.data.mapping.model.MutablePersistentEntity<T,MongoPersistentProperty>
Overrides:
addPersistentProperty in class org.springframework.data.mapping.model.BasicPersistentEntity<T,MongoPersistentProperty>

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
                           throws BeansException
Specified by:
setApplicationContext in interface ApplicationContextAware
Throws:
BeansException

getCollection

public String getCollection()
Description copied from interface: MongoPersistentEntity
Returns the collection the entity shall be persisted to.

Specified by:
getCollection in interface MongoPersistentEntity<T>
Returns:

getVersionProperty

public MongoPersistentProperty getVersionProperty()
Description copied from interface: MongoPersistentEntity
Returns the MongoPersistentProperty that represents the version attribute of an entity. Will not be null if MongoPersistentEntity.hasVersionProperty().

Specified by:
getVersionProperty in interface MongoPersistentEntity<T>
Returns:

hasVersionProperty

public boolean hasVersionProperty()
Description copied from interface: MongoPersistentEntity
Returns whether the entity has a property representing the version of the entity.

Specified by:
hasVersionProperty in interface MongoPersistentEntity<T>
Returns:

Spring Data Document

Copyright © 2012. All Rights Reserved.