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>
,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 newBasicMongoPersistentEntity
with 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.boolean
Returns whether the entity has aTextScore
property.protected MongoPersistentProperty
As a general note: An implicit id property has a name that matches "id" or "_id".void
verify()
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, setEvaluationContextProvider, setPersistentPropertyAccessorFactory
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface org.springframework.data.mongodb.core.mapping.MongoPersistentEntity
hasCollation, isSharded, isUnwrapped
Methods inherited from interface org.springframework.data.mapping.model.MutablePersistentEntity
addAssociation, addPersistentProperty, setEvaluationContextProvider, setPersistentPropertyAccessorFactory
Methods 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 newBasicMongoPersistentEntity
with 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:MongoPersistentEntity
Returns the collection the entity shall be persisted to.- Specified by:
getCollection
in interfaceMongoPersistentEntity<T>
- Returns:
-
getLanguage
Description copied from interface:MongoPersistentEntity
Returns the default language to be used for this entity.- Specified by:
getLanguage
in interfaceMongoPersistentEntity<T>
- Returns:
-
getTextScoreProperty
Description copied from interface:MongoPersistentEntity
Returns the property holding text score value.- Specified by:
getTextScoreProperty
in interfaceMongoPersistentEntity<T>
- Returns:
- null if not present.
- See Also:
-
hasTextScoreProperty
public boolean hasTextScoreProperty()Description copied from interface:MongoPersistentEntity
Returns whether the entity has aTextScore
property.- Specified by:
hasTextScoreProperty
in interfaceMongoPersistentEntity<T>
- Returns:
- true if property annotated with
TextScore
is present.
-
getCollation
Description copied from interface:MongoPersistentEntity
Returns the collation of the entity evaluating a potential SpEL expression within the current context.- Specified by:
getCollation
in interfaceMongoPersistentEntity<T>
- Returns:
- null if not set.
-
getShardKey
Description copied from interface:MongoPersistentEntity
Get the entities shard key if defined.- Specified by:
getShardKey
in interfaceMongoPersistentEntity<T>
- Returns:
ShardKey.none()
if not not set.
-
verify
public void verify()- Specified by:
verify
in interfaceMutablePersistentEntity<T,
MongoPersistentProperty> - Overrides:
verify
in classBasicPersistentEntity<T,
MongoPersistentProperty>
-
getEvaluationContext
- Overrides:
getEvaluationContext
in classBasicPersistentEntity<T,
MongoPersistentProperty>
-
getEvaluationContext
public EvaluationContext getEvaluationContext(Object rootObject, ExpressionDependencies dependencies) - Overrides:
getEvaluationContext
in 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 @seeMappingException
is thrown.- Overrides:
returnPropertyIfBetterIdPropertyCandidateOrNull
in classBasicPersistentEntity<T,
MongoPersistentProperty> - Parameters:
property
- - the new id property candidate- Returns:
- can be null.
-
getEncryptionKeyIds
- Specified by:
getEncryptionKeyIds
in interfaceMongoPersistentEntity<T>
- Returns:
- the resolved encryption keyIds if applicable. An empty
Collection
if no keyIds specified. null noEncrypted
annotation found.
-