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, EnvironmentCapable, 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 TypeMethodDescription@Nullable CollationReturns the collation of the entity evaluating a potential SpEL expression within the current context.Returns the collection the entity shall be persisted to.@Nullable Collection<Object> getEvaluationContext(@Nullable Object rootObject) getEvaluationContext(@Nullable Object rootObject, ExpressionDependencies dependencies) Returns the default language to be used for this entity.<B> PersistentPropertyAccessor<B> getPropertyAccessor(B bean) Get the entities shard key if defined.@Nullable MongoPersistentPropertyReturns the property holding text score value.getValueEvaluationContext(@Nullable Object rootObject) getValueEvaluationContext(@Nullable Object rootObject, ExpressionDependencies dependencies) booleanReturns whether the entity has aTextScoreproperty.booleanprotected @Nullable MongoPersistentPropertyAs a general note: An implicit id property has a name that matches "id" or "_id".voidverify()Methods inherited from class BasicPersistentEntity
addAssociation, addPersistentProperty, doWithAssociations, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getEnvironment, getFallbackIsNewStrategy, getIdentifierAccessor, getIdProperty, getInstanceCreatorMetadata, getName, getPersistentProperties, getPersistentProperty, getPropertyPathAccessor, getType, getTypeAlias, getTypeInformation, getVersionProperty, hasIdProperty, hasVersionProperty, isAnnotationPresent, isCreatorArgument, isIdProperty, isImmutable, isVersionProperty, iterator, requiresPropertyPopulation, setEnvironment, setEvaluationContextProvider, setPersistentPropertyAccessorFactoryMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EnvironmentAware
setEnvironmentMethods inherited from interface Iterable
forEach, iterator, spliteratorMethods inherited from interface MongoPersistentEntity
hasCollation, isSharded, isUnwrappedMethods inherited from interface MutablePersistentEntity
addAssociation, addPersistentProperty, setEvaluationContextProvider, setPersistentPropertyAccessorFactoryMethods inherited from interface PersistentEntity
doWithAll, doWithAssociations, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getIdentifierAccessor, getIdProperty, getInstanceCreatorMetadata, getName, getPersistentProperties, getPersistentProperty, getPersistentProperty, getPropertyPathAccessor, getRequiredAnnotation, getRequiredIdProperty, getRequiredPersistentProperty, getRequiredVersionProperty, getType, getTypeAlias, getTypeInformation, getVersionProperty, hasIdProperty, hasVersionProperty, isAnnotationPresent, isCreatorArgument, isIdProperty, isImmutable, 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 set.
-
verify
public void verify()- Specified by:
verifyin interfaceMutablePersistentEntity<T, MongoPersistentProperty>- Overrides:
verifyin classBasicPersistentEntity<T, MongoPersistentProperty>
-
isNew
- Specified by:
isNewin interfacePersistentEntity<T, MongoPersistentProperty>- Overrides:
isNewin classBasicPersistentEntity<T, MongoPersistentProperty>
-
getPropertyAccessor
- Specified by:
getPropertyAccessorin interfacePersistentEntity<T, MongoPersistentProperty>- Overrides:
getPropertyAccessorin classBasicPersistentEntity<T, MongoPersistentProperty>
-
getEvaluationContext
- Overrides:
getEvaluationContextin classBasicPersistentEntity<T, MongoPersistentProperty>
-
getEvaluationContext
public EvaluationContext getEvaluationContext(@Nullable Object rootObject, ExpressionDependencies dependencies) - Overrides:
getEvaluationContextin classBasicPersistentEntity<T, MongoPersistentProperty>
-
getValueEvaluationContext
- Overrides:
getValueEvaluationContextin classBasicPersistentEntity<T, MongoPersistentProperty>
-
getValueEvaluationContext
public ValueEvaluationContext getValueEvaluationContext(@Nullable Object rootObject, ExpressionDependencies dependencies) - Overrides:
getValueEvaluationContextin classBasicPersistentEntity<T, MongoPersistentProperty>
-
returnPropertyIfBetterIdPropertyCandidateOrNull
protected @Nullable 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.
-