Interface MongoPersistentProperty

All Superinterfaces:
org.springframework.data.mapping.PersistentProperty<MongoPersistentProperty>
All Known Implementing Classes:
BasicMongoPersistentProperty, CachingMongoPersistentProperty

public interface MongoPersistentProperty extends org.springframework.data.mapping.PersistentProperty<MongoPersistentProperty>
MongoDB specific PersistentProperty extension.
Author:
Oliver Gierke, Patryk Wasik, Thomas Darimont, Christoph Strobl, Divya Srivastava
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Simple Converter implementation to transform a MongoPersistentProperty into its field name.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the DBRef if the property is a reference.
    Returns the DocumentReference 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.
    Returns the Java FieldType of the field a property is persisted to.
    boolean
    Returns whether the property uses an annotated field name through Field.
    default boolean
     
    boolean
    Returns whether the property is a DBRef.
    boolean
    Returns whether the property is a DocumentReference.
    boolean
    Returns whether the property is explicitly marked as an identifier property of the owning PersistentEntity.
    boolean
    Returns true when property being annotated with Language.
    boolean
    Returns true whether the property indicates the documents language either by having a getFieldName() equal to language or being annotated with Language.
    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, 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 through Field.
      Returns:
    • getFieldType

      Class<?> getFieldType()
      Returns the Java 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 a DBRef. If this returns true you can expect getDBRef() to return an non-null value.
      Returns:
    • isDocumentReference

      boolean isDocumentReference()
      Returns whether the property is a DocumentReference. If this returns true you can expect getDocumentReference() 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 owning PersistentEntity. A property is an explicit id property if it is annotated with @see Id.
      Returns:
    • isLanguageProperty

      boolean isLanguageProperty()
      Returns true whether the property indicates the documents language either by having a getFieldName() equal to language or being annotated with Language.
      Returns:
      Since:
      1.6
    • isExplicitLanguageProperty

      boolean isExplicitLanguageProperty()
      Returns true when property being annotated with Language.
      Returns:
      Since:
      1.6.1
    • isTextScoreProperty

      boolean isTextScoreProperty()
      Returns whether the property holds the documents score calculated by text search.
      It's marked with TextScore.
      Returns:
      Since:
      1.6
    • getDBRef

      @Nullable DBRef getDBRef()
      Returns the DBRef if the property is a reference.
      Returns:
      See Also:
    • getDocumentReference

      @Nullable DocumentReference getDocumentReference()
      Returns the DocumentReference 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 interface org.springframework.data.mapping.PersistentProperty<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 no Encrypted annotation found.
      Since:
      3.3