public class BasicMongoPersistentEntity<T> extends org.springframework.data.mapping.model.BasicPersistentEntity<T,MongoPersistentProperty> implements MongoPersistentEntity<T>, org.springframework.context.ApplicationContextAware
MongoPersistentEntity
implementation that adds Mongo specific meta-data such as the
collection name and the like.Constructor and Description |
---|
BasicMongoPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
Creates a new
BasicMongoPersistentEntity with the given TypeInformation . |
Modifier and Type | Method and Description |
---|---|
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(org.springframework.context.ApplicationContext applicationContext) |
void |
verify() |
addAssociation, addPersistentProperty, doWithAssociations, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getIdProperty, getName, getPersistenceConstructor, getPersistentProperty, getPersistentProperty, getType, getTypeAlias, getTypeInformation, getVersionProperty, hasIdProperty, hasVersionProperty, isConstructorArgument, isIdProperty, isVersionProperty
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doWithAssociations, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getIdProperty, getName, getPersistenceConstructor, getPersistentProperty, getPersistentProperty, getType, getTypeAlias, getTypeInformation, getVersionProperty, hasIdProperty, hasVersionProperty, isConstructorArgument, isIdProperty, isVersionProperty
public BasicMongoPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
BasicMongoPersistentEntity
with the given TypeInformation
. Will default the
collection name to the entities simple type name.typeInformation
- public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public String getCollection()
MongoPersistentEntity
getCollection
in interface MongoPersistentEntity<T>
public void verify()
verify
in interface org.springframework.data.mapping.model.MutablePersistentEntity<T,MongoPersistentProperty>
verify
in class org.springframework.data.mapping.model.BasicPersistentEntity<T,MongoPersistentProperty>
protected MongoPersistentProperty returnPropertyIfBetterIdPropertyCandidateOrNull(MongoPersistentProperty property)
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.returnPropertyIfBetterIdPropertyCandidateOrNull
in class org.springframework.data.mapping.model.BasicPersistentEntity<T,MongoPersistentProperty>
property
- - the new id property candidateCopyright © 2015. All rights reserved.