Class CachingMongoPersistentProperty
java.lang.Object
org.springframework.data.mapping.model.AbstractPersistentProperty<P>
org.springframework.data.mapping.model.AnnotationBasedPersistentProperty<MongoPersistentProperty>
org.springframework.data.mongodb.core.mapping.BasicMongoPersistentProperty
org.springframework.data.mongodb.core.mapping.CachingMongoPersistentProperty
- All Implemented Interfaces:
PersistentProperty<MongoPersistentProperty>
,MongoPersistentProperty
- Author:
- Oliver Gierke, Mark Paluch, Christoph Strobl
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.mongodb.core.mapping.MongoPersistentProperty
MongoPersistentProperty.PropertyToFieldNameConverter
-
Field Summary
Fields inherited from class org.springframework.data.mongodb.core.mapping.BasicMongoPersistentProperty
ID_FIELD_NAME
-
Constructor Summary
ConstructorDescriptionCachingMongoPersistentProperty
(Property property, MongoPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder, FieldNamingStrategy fieldNamingStrategy) Creates a newCachingMongoPersistentProperty
. -
Method Summary
Modifier and TypeMethodDescriptiongetDBRef()
Returns theDBRef
if the property is a reference.Returns theDocumentReference
if the property is a reference.Returns the key to be used to store the value of the property inside a MongoDocument
.Class<?>
Returns theJava FieldType
of the field a property is persisted to.boolean
Returns whether the property uses an annotated field name throughField
.boolean
boolean
Returns whether the property is aDBRef
.boolean
Returns true when property being annotated withLanguage
.boolean
Also considers fields as id that are of supported id type and name.boolean
Returns true whether the property indicates the documents language either by having aMongoPersistentProperty.getFieldName()
equal to language or being annotated withLanguage
.boolean
Returns whether the property holds the documents score calculated by text search.boolean
boolean
Returns whether property access shall be used for reading the property value.boolean
Returns whether the property should be written to the database if its value is null.Methods inherited from class org.springframework.data.mongodb.core.mapping.BasicMongoPersistentProperty
createAssociation, doGetMongoField, getEncryptionKeyIds, getEvaluationContext, getFieldOrder, isDocumentReference, isExplicitIdProperty, validate
Methods inherited from class org.springframework.data.mapping.model.AnnotationBasedPersistentProperty
findAnnotation, findPropertyOrOwnerAnnotation, getAssociationTargetTypeInformation, getSpelExpression, isAnnotationPresent, isVersionProperty, isWritable, toString
Methods inherited from class org.springframework.data.mapping.model.AbstractPersistentProperty
equals, getActualType, getActualTypeInformation, getAssociation, getAssociationTargetType, getComponentType, getField, getGetter, getMapValueType, getName, getOwner, getPersistentEntityTypeInformation, getProperty, getRawType, getSetter, getType, getTypeInformation, getWither, hashCode, isArray, isCollectionLike, isEntity, isImmutable, isMap, isReadable
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.data.mongodb.core.mapping.MongoPersistentProperty
hasExplicitWriteTarget, isUnwrapped
Methods inherited from interface org.springframework.data.mapping.PersistentProperty
findAnnotation, findPropertyOrOwnerAnnotation, getAccessorForOwner, getActualType, getAssociation, getAssociationTargetType, getAssociationTargetTypeInformation, getComponentType, getField, getGetter, getMapValueType, getName, getOwner, getPersistentEntityTypeInformation, getRawType, getRequiredAnnotation, getRequiredAssociation, getRequiredField, getRequiredGetter, getRequiredSetter, getRequiredWither, getSetter, getSpelExpression, getType, getTypeInformation, getWither, hasActualTypeAnnotation, isAnnotationPresent, isArray, isCollectionLike, isEntity, isImmutable, isMap, isReadable, isVersionProperty, isWritable
-
Constructor Details
-
CachingMongoPersistentProperty
public CachingMongoPersistentProperty(Property property, MongoPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder, @Nullable FieldNamingStrategy fieldNamingStrategy) Creates a newCachingMongoPersistentProperty
.- Parameters:
property
- must not be null.owner
- must not be null.simpleTypeHolder
- must not be null.fieldNamingStrategy
- can be null.
-
-
Method Details
-
isIdProperty
public boolean isIdProperty()Description copied from class:BasicMongoPersistentProperty
Also considers fields as id that are of supported id type and name.- Specified by:
isIdProperty
in interfacePersistentProperty<MongoPersistentProperty>
- Overrides:
isIdProperty
in classBasicMongoPersistentProperty
- See Also:
-
BasicMongoPersistentProperty.SUPPORTED_ID_PROPERTY_NAMES
-
isAssociation
public boolean isAssociation()- Specified by:
isAssociation
in interfacePersistentProperty<MongoPersistentProperty>
- Overrides:
isAssociation
in classAnnotationBasedPersistentProperty<MongoPersistentProperty>
-
hasExplicitFieldName
public boolean hasExplicitFieldName()Description copied from interface:MongoPersistentProperty
Returns whether the property uses an annotated field name throughField
.- Specified by:
hasExplicitFieldName
in interfaceMongoPersistentProperty
- Overrides:
hasExplicitFieldName
in classBasicMongoPersistentProperty
- Returns:
- true if
Field
having non blankField.value()
present.
-
getFieldName
Description copied from class:BasicMongoPersistentProperty
Returns the key to be used to store the value of the property inside a MongoDocument
.- Specified by:
getFieldName
in interfaceMongoPersistentProperty
- Overrides:
getFieldName
in classBasicMongoPersistentProperty
- Returns:
-
writeNullValues
public boolean writeNullValues()Description copied from interface:MongoPersistentProperty
Returns whether the property should be written to the database if its value is null.- Specified by:
writeNullValues
in interfaceMongoPersistentProperty
- Overrides:
writeNullValues
in classBasicMongoPersistentProperty
- Returns:
- See Also:
-
getFieldType
Description copied from interface:MongoPersistentProperty
Returns theJava FieldType
of the field a property is persisted to.- Specified by:
getFieldType
in interfaceMongoPersistentProperty
- Overrides:
getFieldType
in classBasicMongoPersistentProperty
- Returns:
- See Also:
-
usePropertyAccess
public boolean usePropertyAccess()Description copied from interface:MongoPersistentProperty
Returns whether property access shall be used for reading the property value. This means it will use the getter instead of field access.- Specified by:
usePropertyAccess
in interfaceMongoPersistentProperty
- Specified by:
usePropertyAccess
in interfacePersistentProperty<MongoPersistentProperty>
- Overrides:
usePropertyAccess
in classAnnotationBasedPersistentProperty<MongoPersistentProperty>
-
isTransient
public boolean isTransient()- Specified by:
isTransient
in interfacePersistentProperty<MongoPersistentProperty>
- Overrides:
isTransient
in classAnnotationBasedPersistentProperty<MongoPersistentProperty>
-
isTextScoreProperty
public boolean isTextScoreProperty()Description copied from interface:MongoPersistentProperty
Returns whether the property holds the documents score calculated by text search.
It's marked withTextScore
.- Specified by:
isTextScoreProperty
in interfaceMongoPersistentProperty
- Overrides:
isTextScoreProperty
in classBasicMongoPersistentProperty
- Returns:
-
isDbReference
public boolean isDbReference()Description copied from interface:MongoPersistentProperty
Returns whether the property is aDBRef
. If this returns true you can expectMongoPersistentProperty.getDBRef()
to return an non-null value.- Specified by:
isDbReference
in interfaceMongoPersistentProperty
- Overrides:
isDbReference
in classBasicMongoPersistentProperty
- Returns:
-
getDBRef
Description copied from interface:MongoPersistentProperty
Returns theDBRef
if the property is a reference.- Specified by:
getDBRef
in interfaceMongoPersistentProperty
- Overrides:
getDBRef
in classBasicMongoPersistentProperty
- Returns:
- See Also:
-
getDocumentReference
Description copied from interface:MongoPersistentProperty
Returns theDocumentReference
if the property is a reference.- Specified by:
getDocumentReference
in interfaceMongoPersistentProperty
- Overrides:
getDocumentReference
in classBasicMongoPersistentProperty
- Returns:
- null if not present.
- See Also:
-
isLanguageProperty
public boolean isLanguageProperty()Description copied from interface:MongoPersistentProperty
Returns true whether the property indicates the documents language either by having aMongoPersistentProperty.getFieldName()
equal to language or being annotated withLanguage
.- Specified by:
isLanguageProperty
in interfaceMongoPersistentProperty
- Overrides:
isLanguageProperty
in classBasicMongoPersistentProperty
- Returns:
-
isExplicitLanguageProperty
public boolean isExplicitLanguageProperty()Description copied from interface:MongoPersistentProperty
Returns true when property being annotated withLanguage
.- Specified by:
isExplicitLanguageProperty
in interfaceMongoPersistentProperty
- Overrides:
isExplicitLanguageProperty
in classBasicMongoPersistentProperty
- Returns:
-
getMongoField
- Specified by:
getMongoField
in interfaceMongoPersistentProperty
- Overrides:
getMongoField
in classBasicMongoPersistentProperty
- Returns:
- the
MongoField
representing the raw field to read/write in a MongoDB document.
-