Interface MongoPersistentProperty
- All Superinterfaces:
PersistentProperty<MongoPersistentProperty>
- All Known Implementing Classes:
BasicMongoPersistentProperty
,CachingMongoPersistentProperty
MongoDB specific
PersistentProperty
extension.- Author:
- Oliver Gierke, Patryk Wasik, Thomas Darimont, Christoph Strobl, Divya Srivastava
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
SimpleConverter
implementation to transform aMongoPersistentProperty
into its field name. -
Method Summary
Modifier and TypeMethodDescriptiongetDBRef()
Returns theDBRef
if the property is a reference.Returns theDocumentReference
if the property is a reference.Returns the name of the field a property is persisted to.int
Returns the order of the field if defined.Class<?>
Returns theJava FieldType
of the field a property is persisted to.boolean
Returns whether the property uses an annotated field name throughField
.default boolean
boolean
Returns whether the property is aDBRef
.boolean
Returns whether the property is aDocumentReference
.boolean
Returns whether the property is explicitly marked as an identifier property of the owningPersistentEntity
.boolean
Returns true when property being annotated withLanguage
.boolean
Returns true whether the property indicates the documents language either by having agetFieldName()
equal to language or being annotated withLanguage
.boolean
Returns whether the property holds the documents score calculated by text search.default 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 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, isAssociation, isCollectionLike, isEntity, isIdProperty, isImmutable, isMap, isReadable, isTransient, isVersionProperty, isWritable
-
Method Details
-
getFieldName
String getFieldName()Returns the name of the field a property is persisted to.- Returns:
-
hasExplicitFieldName
boolean hasExplicitFieldName()Returns whether the property uses an annotated field name throughField
.- Returns:
-
getFieldType
Class<?> getFieldType()Returns theJava FieldType
of the field a property is persisted to.- Returns:
- Since:
- 2.2
- See Also:
-
getFieldOrder
int getFieldOrder()Returns the order of the field if defined. Will return -1 if undefined.- Returns:
-
writeNullValues
boolean writeNullValues()Returns whether the property should be written to the database if its value is null.- Returns:
- Since:
- 3.3
- See Also:
-
isDbReference
boolean isDbReference()Returns whether the property is aDBRef
. If this returns true you can expectgetDBRef()
to return an non-null value.- Returns:
-
isDocumentReference
boolean isDocumentReference()Returns whether the property is aDocumentReference
. If this returns true you can expectgetDocumentReference()
to return an non-null value.- Returns:
- Since:
- 3.3
-
isExplicitIdProperty
boolean isExplicitIdProperty()Returns whether the property is explicitly marked as an identifier property of the owningPersistentEntity
. A property is an explicit id property if it is annotated with @seeId
.- Returns:
-
isLanguageProperty
boolean isLanguageProperty()Returns true whether the property indicates the documents language either by having agetFieldName()
equal to language or being annotated withLanguage
.- Returns:
- Since:
- 1.6
-
isExplicitLanguageProperty
boolean isExplicitLanguageProperty()Returns true when property being annotated withLanguage
.- Returns:
- Since:
- 1.6.1
-
isTextScoreProperty
boolean isTextScoreProperty()Returns whether the property holds the documents score calculated by text search.
It's marked withTextScore
.- Returns:
- Since:
- 1.6
-
getDBRef
Returns theDBRef
if the property is a reference.- Returns:
- See Also:
-
getDocumentReference
Returns theDocumentReference
if the property is a reference.- Returns:
- null if not present.
- Since:
- 3.3
- See Also:
-
usePropertyAccess
boolean usePropertyAccess()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 interfacePersistentProperty<MongoPersistentProperty>
- Returns:
-
hasExplicitWriteTarget
default boolean hasExplicitWriteTarget()- Returns:
- true if the property defines an explicit
target type
. - Since:
- 2.2
-
isUnwrapped
default boolean isUnwrapped()- Returns:
- true if the property should be unwrapped.
- Since:
- 3.2
-
getEncryptionKeyIds
Collection<Object> getEncryptionKeyIds()- Returns:
- the resolved encryption keyIds if applicable. An empty
Collection
if no keyIds specified. null noEncrypted
annotation found. - Since:
- 3.3
-
getMongoField
MongoField getMongoField()- Returns:
- the
MongoField
representing the raw field to read/write in a MongoDB document. - Since:
- 4.2
-