Class SpannerCompositeKeyProperty
java.lang.Object
com.google.cloud.spring.data.spanner.core.mapping.SpannerCompositeKeyProperty
- All Implemented Interfaces:
SpannerPersistentProperty,org.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
Represents an persistent property just to represent Cloud Spanner primary keys, and does not
correspond to actual properties of POJOs, as it might even be a composite, multi-column key.
- Since:
- 1.1
-
Constructor Summary
ConstructorsConstructorDescriptionSpannerCompositeKeyProperty(SpannerPersistentEntity spannerPersistentEntity, SpannerPersistentProperty[] primaryKeyColumns) -
Method Summary
Modifier and TypeMethodDescription<A extends Annotation>
AfindAnnotation(Class<A> annotationType) <A extends Annotation>
AfindPropertyOrOwnerAnnotation(Class<A> annotationType) Class<?>com.google.cloud.spanner.Type.CodeOptionally directly specify the column type in Cloud Spanner.org.springframework.data.mapping.Association<SpannerPersistentProperty>Class<?>Returnsnull.org.springframework.data.util.TypeInformation<?>Returns null for consistency with isAssociation().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 Google Cloud Spanner table mapped to this property.Class<?>getField()Class<?>Gets the maximum data length of the column if provided.getName()org.springframework.data.mapping.PersistentEntity<?,SpannerPersistentProperty> getOwner()Iterable<? extends org.springframework.data.util.TypeInformation<?>>Gets the order of this column if it is part of the table's primary key.Class<?>Class<?>getType()org.springframework.data.util.TypeInformation<?>getWhere()ReturnsWHEREclause of the interleaved property or empty string if no value.Returnsnull.booleanhasWhere()Returns true when the property has an annotationWherewith a non-empty value.booleanisAnnotationPresent(Class<? extends Annotation> annotationType) booleanisArray()booleanbooleanbooleanIf 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.booleanisEntity()booleanIf the column's schema should be NOT NULL when generating a schema based on an entity class.booleanbooleanReturnsfalse.booleanTrue if property is a collection of child entities.booleanReturn whether this property is a lazily-fetched interleaved property.booleanisMap()booleanisMapped()True if property corresponds to a column a Cloud Spanner table or child entities stored in Cloud Spanner.booleanbooleanbooleanbooleanbooleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.mapping.PersistentProperty
getAccessorForOwner, getRequiredAnnotation, getRequiredAssociation, getRequiredField, getRequiredGetter, getRequiredSetter, getRequiredWither, hasActualTypeAnnotation
-
Constructor Details
-
SpannerCompositeKeyProperty
public SpannerCompositeKeyProperty(SpannerPersistentEntity spannerPersistentEntity, SpannerPersistentProperty[] primaryKeyColumns)
-
-
Method Details
-
getColumnName
Description copied from interface:SpannerPersistentPropertyGets the name of the column in the Google Cloud Spanner table mapped to this property.- Specified by:
getColumnNamein interfaceSpannerPersistentProperty- Returns:
- the name of the column.
-
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.
-
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.
-
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.
-
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:
-
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.
-
getOwner
- Specified by:
getOwnerin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getName
- Specified by:
getNamein interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getType
- Specified by:
getTypein interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getTypeInformation
public org.springframework.data.util.TypeInformation<?> getTypeInformation()- Specified by:
getTypeInformationin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getGetter
- Specified by:
getGetterin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getSetter
- Specified by:
getSetterin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getField
- Specified by:
getFieldin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getSpelExpression
- Specified by:
getSpelExpressionin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getAssociation
@Nullable public org.springframework.data.mapping.Association<SpannerPersistentProperty> getAssociation()- Specified by:
getAssociationin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isEntity
public boolean isEntity()- Specified by:
isEntityin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isIdProperty
public boolean isIdProperty()- Specified by:
isIdPropertyin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isVersionProperty
public boolean isVersionProperty()- Specified by:
isVersionPropertyin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isCollectionLike
public boolean isCollectionLike()- Specified by:
isCollectionLikein interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isMap
public boolean isMap()- Specified by:
isMapin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isArray
public boolean isArray()- Specified by:
isArrayin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isTransient
public boolean isTransient()- Specified by:
isTransientin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isReadable
public boolean isReadable()- Specified by:
isReadablein interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isWritable
public boolean isWritable()- Specified by:
isWritablein interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isAssociation
public boolean isAssociation()- Specified by:
isAssociationin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getComponentType
- Specified by:
getComponentTypein interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getRawType
- Specified by:
getRawTypein interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getMapValueType
- Specified by:
getMapValueTypein interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getActualType
- Specified by:
getActualTypein interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
findAnnotation
- Specified by:
findAnnotationin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
findPropertyOrOwnerAnnotation
- Specified by:
findPropertyOrOwnerAnnotationin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isAnnotationPresent
- Specified by:
isAnnotationPresentin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
usePropertyAccess
public boolean usePropertyAccess()- Specified by:
usePropertyAccessin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getAssociationTargetType
Returnsnull.- Specified by:
getAssociationTargetTypein interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>- Since:
- 1.1
-
isImmutable
public boolean isImmutable()Returnsfalse.- Specified by:
isImmutablein interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>- Since:
- 1.1
-
getWither
Returnsnull.- Specified by:
getWitherin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>- Since:
- 1.1
-
getPersistentEntityTypeInformation
public Iterable<? extends org.springframework.data.util.TypeInformation<?>> getPersistentEntityTypeInformation()- Specified by:
getPersistentEntityTypeInformationin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getAssociationTargetTypeInformation
public org.springframework.data.util.TypeInformation<?> getAssociationTargetTypeInformation()Returns null for consistency with isAssociation().- Specified by:
getAssociationTargetTypeInformationin interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>- Returns:
- always null
-