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.Code
Optionally 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()
ReturnsWHERE
clause of the interleaved property or empty string if no value.Returnsnull
.boolean
hasWhere()
Returns true when the property has an annotationWhere
with a non-empty value.boolean
isAnnotationPresent
(Class<? extends Annotation> annotationType) boolean
isArray()
boolean
boolean
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
isEntity()
boolean
If the column's schema should be NOT NULL when generating a schema based on an entity class.boolean
boolean
Returnsfalse
.boolean
True if property is a collection of child entities.boolean
Return whether this property is a lazily-fetched interleaved property.boolean
isMap()
boolean
isMapped()
True if property corresponds to a column a Cloud Spanner table or child entities stored in Cloud Spanner.boolean
boolean
boolean
boolean
boolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:SpannerPersistentProperty
Gets the name of the column in the Google Cloud Spanner table mapped to this property.- Specified by:
getColumnName
in interfaceSpannerPersistentProperty
- Returns:
- the name of the column.
-
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 interfaceSpannerPersistentProperty
- Returns:
- the inner type of the column.
-
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 interfaceSpannerPersistentProperty
- 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 interfaceSpannerPersistentProperty
- 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 interfaceSpannerPersistentProperty
- 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 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:SpannerPersistentProperty
If the column's schema should be NOT NULL when generating a schema based on an entity class.- Specified by:
isGenerateSchemaNotNull
in interfaceSpannerPersistentProperty
- 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 interfaceSpannerPersistentProperty
- Returns:
true
if the property is an auto-populated commit timestamp.false
otherwise.
-
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 interfaceSpannerPersistentProperty
- 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 interfaceSpannerPersistentProperty
- 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 interfaceSpannerPersistentProperty
- Returns:
true
if the property is eagerly-fetched.false
otherwise.
-
getWhere
Description copied from interface:SpannerPersistentProperty
ReturnsWHERE
clause of the interleaved property or empty string if no value.- Specified by:
getWhere
in interfaceSpannerPersistentProperty
- 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 annotationWhere
with a non-empty value.- Specified by:
hasWhere
in interfaceSpannerPersistentProperty
- Returns:
- true when the property has an annotation
Where
with a non-empty value. - See Also:
-
getMaxColumnLength
Description copied from interface:SpannerPersistentProperty
Gets the maximum data length of the column if provided.- Specified by:
getMaxColumnLength
in interfaceSpannerPersistentProperty
- Returns:
- an optional that is empty if no maximum length was provided.
-
getOwner
- Specified by:
getOwner
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getName
- Specified by:
getName
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getType
- Specified by:
getType
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getTypeInformation
public org.springframework.data.util.TypeInformation<?> getTypeInformation()- Specified by:
getTypeInformation
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getGetter
- Specified by:
getGetter
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getSetter
- Specified by:
getSetter
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getField
- Specified by:
getField
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getSpelExpression
- Specified by:
getSpelExpression
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getAssociation
@Nullable public org.springframework.data.mapping.Association<SpannerPersistentProperty> getAssociation()- Specified by:
getAssociation
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isEntity
public boolean isEntity()- Specified by:
isEntity
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isIdProperty
public boolean isIdProperty()- Specified by:
isIdProperty
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isVersionProperty
public boolean isVersionProperty()- Specified by:
isVersionProperty
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isCollectionLike
public boolean isCollectionLike()- Specified by:
isCollectionLike
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isMap
public boolean isMap()- Specified by:
isMap
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isArray
public boolean isArray()- Specified by:
isArray
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isTransient
public boolean isTransient()- Specified by:
isTransient
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isReadable
public boolean isReadable()- Specified by:
isReadable
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isWritable
public boolean isWritable()- Specified by:
isWritable
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isAssociation
public boolean isAssociation()- Specified by:
isAssociation
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getComponentType
- Specified by:
getComponentType
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getRawType
- Specified by:
getRawType
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getMapValueType
- Specified by:
getMapValueType
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getActualType
- Specified by:
getActualType
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
findAnnotation
- Specified by:
findAnnotation
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
findPropertyOrOwnerAnnotation
- Specified by:
findPropertyOrOwnerAnnotation
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
isAnnotationPresent
- Specified by:
isAnnotationPresent
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
usePropertyAccess
public boolean usePropertyAccess()- Specified by:
usePropertyAccess
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getAssociationTargetType
Returnsnull
.- Specified by:
getAssociationTargetType
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
- Since:
- 1.1
-
isImmutable
public boolean isImmutable()Returnsfalse
.- Specified by:
isImmutable
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
- Since:
- 1.1
-
getWither
Returnsnull
.- Specified by:
getWither
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
- Since:
- 1.1
-
getPersistentEntityTypeInformation
public Iterable<? extends org.springframework.data.util.TypeInformation<?>> getPersistentEntityTypeInformation()- Specified by:
getPersistentEntityTypeInformation
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
-
getAssociationTargetTypeInformation
public org.springframework.data.util.TypeInformation<?> getAssociationTargetTypeInformation()Returns null for consistency with isAssociation().- Specified by:
getAssociationTargetTypeInformation
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
- Returns:
- always null
-