Spring Data MongoDB - Core

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, MutablePersistentEntity<T,MongoPersistentProperty>, PersistentEntity<T,MongoPersistentProperty>, MongoPersistentEntity<T>

public class BasicMongoPersistentEntity<T>
extends 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, Thomas Darimont

Constructor Summary
BasicMongoPersistentEntity(TypeInformation<T> typeInformation)
          Creates a new BasicMongoPersistentEntity with the given TypeInformation.
 
Method Summary
 String getCollection()
          Returns the collection the entity shall be persisted to.
protected  MongoPersistentProperty returnPropertyIfBetterIdPropertyCandidateOrNull(MongoPersistentProperty property)
          As a general note: An implicit id property has a name that matches "id" or "_id".
 void setApplicationContext(ApplicationContext applicationContext)
           
 void verify()
           
 
Methods inherited from class org.springframework.data.mapping.model.BasicPersistentEntity
addAssociation, addPersistentProperty, doWithAssociations, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getIdProperty, getName, getPersistenceConstructor, getPersistentProperty, getPersistentProperty, getType, getTypeAlias, getTypeInformation, getVersionProperty, hasIdProperty, hasVersionProperty, isConstructorArgument, isIdProperty, isVersionProperty
 
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, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getIdProperty, getName, getPersistenceConstructor, getPersistentProperty, getPersistentProperty, getType, getTypeAlias, getTypeInformation, getVersionProperty, hasIdProperty, hasVersionProperty, isConstructorArgument, isIdProperty, isVersionProperty
 

Constructor Detail

BasicMongoPersistentEntity

public BasicMongoPersistentEntity(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

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:

verify

public void verify()
Specified by:
verify in interface MutablePersistentEntity<T,MongoPersistentProperty>
Overrides:
verify in class BasicPersistentEntity<T,MongoPersistentProperty>

returnPropertyIfBetterIdPropertyCandidateOrNull

protected MongoPersistentProperty returnPropertyIfBetterIdPropertyCandidateOrNull(MongoPersistentProperty property)
As a general note: An implicit id property has a name that matches "id" or "_id". An explicit id property is one that is annotated with @see Id. The property id is updated according to the following rules: 1) An id property which is defined explicitly takes precedence over an implicitly defined id property. 2) In case of any ambiguity a @see MappingException is thrown.

Overrides:
returnPropertyIfBetterIdPropertyCandidateOrNull in class BasicPersistentEntity<T,MongoPersistentProperty>
Parameters:
property - - the new id property candidate
Returns:

Spring Data MongoDB - Core

Copyright © 2011-2014–2014 Pivotal Software, Inc.. All rights reserved.