Module spring.data.mongodb
Class BasicMongoPersistentEntity<T>
java.lang.Object
org.springframework.data.mapping.model.BasicPersistentEntity<T,MongoPersistentProperty>
org.springframework.data.mongodb.core.mapping.BasicMongoPersistentEntity<T>
- All Implemented Interfaces:
Iterable<MongoPersistentProperty>,Aware,EnvironmentAware,MutablePersistentEntity<T,,MongoPersistentProperty> PersistentEntity<T,,MongoPersistentProperty> MongoPersistentEntity<T>
public class BasicMongoPersistentEntity<T>
extends BasicPersistentEntity<T,MongoPersistentProperty>
implements MongoPersistentEntity<T>
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, Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionBasicMongoPersistentEntity(TypeInformation<T> typeInformation) Creates a newBasicMongoPersistentEntitywith the givenTypeInformation. -
Method Summary
Modifier and TypeMethodDescriptionReturns the collation of the entity evaluating a potential SpEL expression within the current context.Returns the collection the entity shall be persisted to.getEvaluationContext(Object rootObject) getEvaluationContext(Object rootObject, ExpressionDependencies dependencies) Returns the default language to be used for this entity.Get the entities shard key if defined.Returns the property holding text score value.getValueEvaluationContext(Object rootObject) getValueEvaluationContext(Object rootObject, ExpressionDependencies dependencies) booleanReturns whether the entity has aTextScoreproperty.protected MongoPersistentPropertyAs a general note: An implicit id property has a name that matches "id" or "_id".voidverify()Methods inherited from class org.springframework.data.mapping.model.BasicPersistentEntity
addAssociation, addPersistentProperty, doWithAssociations, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getFallbackIsNewStrategy, getIdentifierAccessor, getIdProperty, getInstanceCreatorMetadata, getName, getPersistenceConstructor, getPersistentProperties, getPersistentProperty, getPropertyAccessor, getPropertyPathAccessor, getType, getTypeAlias, getTypeInformation, getVersionProperty, hasIdProperty, hasVersionProperty, isAnnotationPresent, isCreatorArgument, isIdProperty, isImmutable, isNew, isVersionProperty, iterator, requiresPropertyPopulation, setEnvironment, setEvaluationContextProvider, setPersistentPropertyAccessorFactoryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.EnvironmentAware
setEnvironmentMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface org.springframework.data.mongodb.core.mapping.MongoPersistentEntity
hasCollation, isSharded, isUnwrappedMethods inherited from interface org.springframework.data.mapping.model.MutablePersistentEntity
addAssociation, addPersistentProperty, setEvaluationContextProvider, setPersistentPropertyAccessorFactoryMethods inherited from interface org.springframework.data.mapping.PersistentEntity
doWithAll, doWithAssociations, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getIdentifierAccessor, getIdProperty, getInstanceCreatorMetadata, getName, getPersistenceConstructor, getPersistentProperties, getPersistentProperty, getPersistentProperty, getPropertyAccessor, getPropertyPathAccessor, getRequiredAnnotation, getRequiredIdProperty, getRequiredPersistentProperty, getRequiredVersionProperty, getType, getTypeAlias, getTypeInformation, getVersionProperty, hasIdProperty, hasVersionProperty, isAnnotationPresent, isConstructorArgument, isCreatorArgument, isIdProperty, isImmutable, isNew, isVersionProperty, requiresPropertyPopulation
-
Constructor Details
-
BasicMongoPersistentEntity
Creates a newBasicMongoPersistentEntitywith the givenTypeInformation. Will default the collection name to the entities simple type name.- Parameters:
typeInformation- must not be null.
-
-
Method Details
-
getCollection
Description copied from interface:MongoPersistentEntityReturns the collection the entity shall be persisted to.- Specified by:
getCollectionin interfaceMongoPersistentEntity<T>- Returns:
-
getLanguage
Description copied from interface:MongoPersistentEntityReturns the default language to be used for this entity.- Specified by:
getLanguagein interfaceMongoPersistentEntity<T>- Returns:
-
getTextScoreProperty
Description copied from interface:MongoPersistentEntityReturns the property holding text score value.- Specified by:
getTextScorePropertyin interfaceMongoPersistentEntity<T>- Returns:
- null if not present.
- See Also:
-
hasTextScoreProperty
public boolean hasTextScoreProperty()Description copied from interface:MongoPersistentEntityReturns whether the entity has aTextScoreproperty.- Specified by:
hasTextScorePropertyin interfaceMongoPersistentEntity<T>- Returns:
- true if property annotated with
TextScoreis present.
-
getCollation
Description copied from interface:MongoPersistentEntityReturns the collation of the entity evaluating a potential SpEL expression within the current context.- Specified by:
getCollationin interfaceMongoPersistentEntity<T>- Returns:
- null if not set.
-
getShardKey
Description copied from interface:MongoPersistentEntityGet the entities shard key if defined.- Specified by:
getShardKeyin interfaceMongoPersistentEntity<T>- Returns:
ShardKey.none()if not not set.
-
verify
public void verify()- Specified by:
verifyin interfaceMutablePersistentEntity<T,MongoPersistentProperty> - Overrides:
verifyin classBasicPersistentEntity<T,MongoPersistentProperty>
-
getEvaluationContext
- Overrides:
getEvaluationContextin classBasicPersistentEntity<T,MongoPersistentProperty>
-
getEvaluationContext
public EvaluationContext getEvaluationContext(Object rootObject, ExpressionDependencies dependencies) - Overrides:
getEvaluationContextin classBasicPersistentEntity<T,MongoPersistentProperty>
-
getValueEvaluationContext
- Overrides:
getValueEvaluationContextin classBasicPersistentEntity<T,MongoPersistentProperty>
-
getValueEvaluationContext
public ValueEvaluationContext getValueEvaluationContext(Object rootObject, ExpressionDependencies dependencies) - Overrides:
getValueEvaluationContextin classBasicPersistentEntity<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 @seeId. 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 @seeMappingExceptionis thrown.- Overrides:
returnPropertyIfBetterIdPropertyCandidateOrNullin classBasicPersistentEntity<T,MongoPersistentProperty> - Parameters:
property- - the new id property candidate- Returns:
- can be null.
-
getEncryptionKeyIds
- Specified by:
getEncryptionKeyIdsin interfaceMongoPersistentEntity<T>- Returns:
- the resolved encryption keyIds if applicable. An empty
Collectionif no keyIds specified. null noEncryptedannotation found.
-