Class SpannerPersistentPropertyImpl

java.lang.Object
org.springframework.data.mapping.model.AbstractPersistentProperty<P>
org.springframework.data.mapping.model.AnnotationBasedPersistentProperty<SpannerPersistentProperty>
com.google.cloud.spring.data.spanner.core.mapping.SpannerPersistentPropertyImpl
All Implemented Interfaces:
SpannerPersistentProperty, org.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>

public class SpannerPersistentPropertyImpl extends org.springframework.data.mapping.model.AnnotationBasedPersistentProperty<SpannerPersistentProperty> implements SpannerPersistentProperty
Represents an implementation for SpannerPersistentProperty, which is a property of a SpannerPersistentEntity stored in a Cloud Spanner table.
Since:
1.1
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.springframework.data.mapping.Association<SpannerPersistentProperty>
     
    boolean
     
    com.google.cloud.spanner.Type.Code
    Optionally directly specify the column type in Cloud Spanner.
    Gets the inner type of the column, which is meaningful for columns of type ARRAY in Google Cloud Spanner.
    Gets the name of the column in the Cloud Spanner table mapped to this property.
    Gets the maximum data length of the column if provided.
    Iterable<? extends org.springframework.data.util.TypeInformation<?>>
    Only provides types that are also annotated with Table.
    Gets the order of this column if it is part of the table's primary key.
    Returns WHERE clause of the interleaved property or empty string if no value.
    int
     
    boolean
    Returns true when the property has an annotation Where with a non-empty value.
    boolean
    If the column is a Cloud Spanner commit timestamp auto-populating column.
    boolean
    Return whether this property is an eagerly-fetched interleaved property.
    boolean
    True if the property is an embedded class containing more columns.
    boolean
    If the column's schema should be NOT NULL when generating a schema based on an entity class.
    boolean
     
    boolean
    True if property is a collection of child entities.
    boolean
    Return whether this property is a lazily-fetched interleaved property.
    boolean
    True if property corresponds to a column a Cloud Spanner table or child entities stored in Cloud Spanner.

    Methods inherited from class org.springframework.data.mapping.model.AnnotationBasedPersistentProperty

    findAnnotation, findPropertyOrOwnerAnnotation, getAssociationTargetTypeInformation, getSpelExpression, isAnnotationPresent, isAssociation, isTransient, isVersionProperty, isWritable, toString, usePropertyAccess

    Methods inherited from class org.springframework.data.mapping.model.AbstractPersistentProperty

    getActualType, getActualTypeInformation, getAssociation, getAssociationTargetType, getComponentType, getField, getGetter, getMapValueType, getName, getOwner, getProperty, getRawType, getSetter, getType, getTypeInformation, getWither, 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.mapping.PersistentProperty

    findAnnotation, findPropertyOrOwnerAnnotation, getAccessorForOwner, getActualType, getAssociation, getAssociationTargetType, getAssociationTargetTypeInformation, getComponentType, getField, getGetter, getMapValueType, getName, getOwner, getRawType, getRequiredAnnotation, getRequiredAssociation, getRequiredField, getRequiredGetter, getRequiredSetter, getRequiredWither, getSetter, getSpelExpression, getType, getTypeInformation, getWither, hasActualTypeAnnotation, isAnnotationPresent, isArray, isAssociation, isCollectionLike, isEntity, isImmutable, isMap, isReadable, isTransient, isVersionProperty, isWritable, usePropertyAccess
  • Method Details

    • getPersistentEntityTypeInformation

      @NonNull public Iterable<? extends org.springframework.data.util.TypeInformation<?>> getPersistentEntityTypeInformation()
      Only provides types that are also annotated with Table.
      Specified by:
      getPersistentEntityTypeInformation in interface org.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
      Overrides:
      getPersistentEntityTypeInformation in class org.springframework.data.mapping.model.AbstractPersistentProperty<SpannerPersistentProperty>
    • createAssociation

      @NonNull protected org.springframework.data.mapping.Association<SpannerPersistentProperty> createAssociation()
      Specified by:
      createAssociation in class org.springframework.data.mapping.model.AbstractPersistentProperty<SpannerPersistentProperty>
    • getColumnName

      public String getColumnName()
      Gets the name of the column in the Cloud Spanner table mapped to this property. The column name is resolved using the FieldNamingStrategy passed in to the SpannerPersistentPropertyImpl(Property, PersistentEntity, SimpleTypeHolder, FieldNamingStrategy) constructor. This is by default the by default
      Specified by:
      getColumnName in interface SpannerPersistentProperty
      Returns:
      the name of the column.
      Throws:
      org.springframework.data.mapping.MappingException - if the resolution fails
    • getColumnInnerType

      public Class<?> getColumnInnerType()
      Description copied from interface: SpannerPersistentProperty
      Gets the inner type of the column, which is meaningful for columns of type ARRAY in Google Cloud Spanner.
      Specified by:
      getColumnInnerType in interface SpannerPersistentProperty
      Returns:
      the inner type of the column.
    • getPrimaryKeyOrder

      public OptionalInt getPrimaryKeyOrder()
      Description copied from interface: SpannerPersistentProperty
      Gets the order of this column if it is part of the table's primary key. Will be empty or null if this column is not part of the primary key.
      Specified by:
      getPrimaryKeyOrder in interface SpannerPersistentProperty
      Returns:
      an optional that is empty if no primary key order exists for the property.
    • isMapped

      public boolean isMapped()
      Description copied from interface: SpannerPersistentProperty
      True if property corresponds to a column a Cloud Spanner table or child entities stored in Cloud Spanner. False otherwise.
      Specified by:
      isMapped in interface SpannerPersistentProperty
      Returns:
      true if this property will be mapped to and from Cloud Spanner. False otherwise.
    • isEmbedded

      public boolean isEmbedded()
      Description copied from interface: SpannerPersistentProperty
      True if the property is an embedded class containing more columns. False otherwise.
      Specified by:
      isEmbedded in interface SpannerPersistentProperty
      Returns:
      true if the property is embedded.
    • isInterleaved

      public boolean isInterleaved()
      Description copied from interface: SpannerPersistentProperty
      True if property is a collection of child entities. False otherwise.
      Specified by:
      isInterleaved in interface SpannerPersistentProperty
      Returns:
      true if property is a collection of child entities corresponding to an interleaved child table. False otherwise.
    • getMaxColumnLength

      public OptionalLong getMaxColumnLength()
      Description copied from interface: SpannerPersistentProperty
      Gets the maximum data length of the column if provided.
      Specified by:
      getMaxColumnLength in interface SpannerPersistentProperty
      Returns:
      an optional that is empty if no maximum length was provided.
    • isGenerateSchemaNotNull

      public boolean isGenerateSchemaNotNull()
      Description copied from interface: SpannerPersistentProperty
      If the column's schema should be NOT NULL when generating a schema based on an entity class.
      Specified by:
      isGenerateSchemaNotNull in interface SpannerPersistentProperty
      Returns:
      true if the column should be NOT NULL in generated DDL. false otherwise.
    • isCommitTimestamp

      public boolean isCommitTimestamp()
      Description copied from interface: SpannerPersistentProperty
      If the column is a Cloud Spanner commit timestamp auto-populating column. This property is always stored in Cloud Spanner as a Timestamp, and will update based on the latest commit.
      Specified by:
      isCommitTimestamp in interface SpannerPersistentProperty
      Returns:
      true if the property is an auto-populated commit timestamp. false otherwise.
    • getWhere

      public String getWhere()
      Description copied from interface: SpannerPersistentProperty
      Returns WHERE clause of the interleaved property or empty string if no value.
      Specified by:
      getWhere in interface SpannerPersistentProperty
      Returns:
      a WHERE clause of the interleaved property or empty string.
      See Also:
    • hasWhere

      public boolean hasWhere()
      Description copied from interface: SpannerPersistentProperty
      Returns true when the property has an annotation Where with a non-empty value.
      Specified by:
      hasWhere in interface SpannerPersistentProperty
      Returns:
      true when the property has an annotation Where with a non-empty value.
      See Also:
    • getAnnotatedColumnItemType

      public com.google.cloud.spanner.Type.Code getAnnotatedColumnItemType()
      Description copied from interface: SpannerPersistentProperty
      Optionally directly specify the column type in Cloud Spanner. For ARRAY columns this refers to type of the item the array holds. If this is not specified then it is inferred.
      Specified by:
      getAnnotatedColumnItemType in interface SpannerPersistentProperty
      Returns:
      the user-specified column item type.
    • isLazyInterleaved

      public boolean isLazyInterleaved()
      Description copied from interface: SpannerPersistentProperty
      Return whether this property is a lazily-fetched interleaved property.
      Specified by:
      isLazyInterleaved in interface SpannerPersistentProperty
      Returns:
      true if the property is lazily-fetched. false otherwise.
    • isEagerInterleaved

      public boolean isEagerInterleaved()
      Description copied from interface: SpannerPersistentProperty
      Return whether this property is an eagerly-fetched interleaved property.
      Specified by:
      isEagerInterleaved in interface SpannerPersistentProperty
      Returns:
      true if the property is eagerly-fetched. false otherwise.
    • isIdProperty

      public boolean isIdProperty()
      Specified by:
      isIdProperty in interface org.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
      Overrides:
      isIdProperty in class org.springframework.data.mapping.model.AnnotationBasedPersistentProperty<SpannerPersistentProperty>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class org.springframework.data.mapping.model.AbstractPersistentProperty<SpannerPersistentProperty>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class org.springframework.data.mapping.model.AbstractPersistentProperty<SpannerPersistentProperty>