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 TypeMethodDescriptionprotected org.springframework.data.mapping.Association<SpannerPersistentProperty>booleancom.google.cloud.spanner.Type.CodeOptionally directly specify the column type in Cloud Spanner.Class<?>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 withTable.Gets the order of this column if it is part of the table's primary key.getWhere()ReturnsWHEREclause of the interleaved property or empty string if no value.inthashCode()booleanhasWhere()Returns true when the property has an annotationWherewith a non-empty value.booleanIf the column is a Cloud Spanner commit timestamp auto-populating column.booleanReturn whether this property is an eagerly-fetched interleaved property.booleanTrue if the property is an embedded class containing more columns.booleanIf the column's schema should be NOT NULL when generating a schema based on an entity class.booleanbooleanTrue if property is a collection of child entities.booleanReturn whether this property is a lazily-fetched interleaved property.booleanisMapped()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, usePropertyAccessMethods 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, isReadableMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 withTable.- Specified by:
getPersistentEntityTypeInformationin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>- Overrides:
getPersistentEntityTypeInformationin classorg.springframework.data.mapping.model.AbstractPersistentProperty<SpannerPersistentProperty>
-
createAssociation
@NonNull protected org.springframework.data.mapping.Association<SpannerPersistentProperty> createAssociation()- Specified by:
createAssociationin classorg.springframework.data.mapping.model.AbstractPersistentProperty<SpannerPersistentProperty>
-
getColumnName
Gets the name of the column in the Cloud Spanner table mapped to this property. The column name is resolved using theFieldNamingStrategypassed in to theSpannerPersistentPropertyImpl(Property, PersistentEntity, SimpleTypeHolder, FieldNamingStrategy)constructor. This is by default the by default- Specified by:
getColumnNamein interfaceSpannerPersistentProperty- Returns:
- the name of the column.
- Throws:
org.springframework.data.mapping.MappingException- if the resolution fails
-
getColumnInnerType
Description copied from interface:SpannerPersistentPropertyGets the inner type of the column, which is meaningful for columns of type ARRAY in Google Cloud Spanner.- Specified by:
getColumnInnerTypein interfaceSpannerPersistentProperty- Returns:
- the inner type of the column.
-
getPrimaryKeyOrder
Description copied from interface:SpannerPersistentPropertyGets 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:
getPrimaryKeyOrderin interfaceSpannerPersistentProperty- Returns:
- an optional that is empty if no primary key order exists for the property.
-
isMapped
public boolean isMapped()Description copied from interface:SpannerPersistentPropertyTrue if property corresponds to a column a Cloud Spanner table or child entities stored in Cloud Spanner. False otherwise.- Specified by:
isMappedin interfaceSpannerPersistentProperty- Returns:
- true if this property will be mapped to and from Cloud Spanner. False otherwise.
-
isEmbedded
public boolean isEmbedded()Description copied from interface:SpannerPersistentPropertyTrue if the property is an embedded class containing more columns. False otherwise.- Specified by:
isEmbeddedin interfaceSpannerPersistentProperty- Returns:
- true if the property is embedded.
-
isInterleaved
public boolean isInterleaved()Description copied from interface:SpannerPersistentPropertyTrue if property is a collection of child entities. False otherwise.- Specified by:
isInterleavedin interfaceSpannerPersistentProperty- Returns:
- true if property is a collection of child entities corresponding to an interleaved child table. False otherwise.
-
getMaxColumnLength
Description copied from interface:SpannerPersistentPropertyGets the maximum data length of the column if provided.- Specified by:
getMaxColumnLengthin interfaceSpannerPersistentProperty- Returns:
- an optional that is empty if no maximum length was provided.
-
isGenerateSchemaNotNull
public boolean isGenerateSchemaNotNull()Description copied from interface:SpannerPersistentPropertyIf the column's schema should be NOT NULL when generating a schema based on an entity class.- Specified by:
isGenerateSchemaNotNullin interfaceSpannerPersistentProperty- Returns:
trueif the column should be NOT NULL in generated DDL.falseotherwise.
-
isCommitTimestamp
public boolean isCommitTimestamp()Description copied from interface:SpannerPersistentPropertyIf 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:
isCommitTimestampin interfaceSpannerPersistentProperty- Returns:
trueif the property is an auto-populated commit timestamp.falseotherwise.
-
getWhere
Description copied from interface:SpannerPersistentPropertyReturnsWHEREclause of the interleaved property or empty string if no value.- Specified by:
getWherein interfaceSpannerPersistentProperty- Returns:
- a
WHEREclause of the interleaved property or empty string. - See Also:
-
hasWhere
public boolean hasWhere()Description copied from interface:SpannerPersistentPropertyReturns true when the property has an annotationWherewith a non-empty value.- Specified by:
hasWherein interfaceSpannerPersistentProperty- Returns:
- true when the property has an annotation
Wherewith a non-empty value. - See Also:
-
getAnnotatedColumnItemType
public com.google.cloud.spanner.Type.Code getAnnotatedColumnItemType()Description copied from interface:SpannerPersistentPropertyOptionally 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:
getAnnotatedColumnItemTypein interfaceSpannerPersistentProperty- Returns:
- the user-specified column item type.
-
isLazyInterleaved
public boolean isLazyInterleaved()Description copied from interface:SpannerPersistentPropertyReturn whether this property is a lazily-fetched interleaved property.- Specified by:
isLazyInterleavedin interfaceSpannerPersistentProperty- Returns:
trueif the property is lazily-fetched.falseotherwise.
-
isEagerInterleaved
public boolean isEagerInterleaved()Description copied from interface:SpannerPersistentPropertyReturn whether this property is an eagerly-fetched interleaved property.- Specified by:
isEagerInterleavedin interfaceSpannerPersistentProperty- Returns:
trueif the property is eagerly-fetched.falseotherwise.
-
isIdProperty
public boolean isIdProperty()- Specified by:
isIdPropertyin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>- Overrides:
isIdPropertyin classorg.springframework.data.mapping.model.AnnotationBasedPersistentProperty<SpannerPersistentProperty>
-
equals
- Overrides:
equalsin classorg.springframework.data.mapping.model.AbstractPersistentProperty<SpannerPersistentProperty>
-
hashCode
public int hashCode()- Overrides:
hashCodein classorg.springframework.data.mapping.model.AbstractPersistentProperty<SpannerPersistentProperty>
-