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>
boolean
com.google.cloud.spanner.Type.Code
Optionally 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()
ReturnsWHERE
clause of the interleaved property or empty string if no value.int
hashCode()
boolean
hasWhere()
Returns true when the property has an annotationWhere
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
isMapped()
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 withTable
.- Specified by:
getPersistentEntityTypeInformation
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
- Overrides:
getPersistentEntityTypeInformation
in classorg.springframework.data.mapping.model.AbstractPersistentProperty<SpannerPersistentProperty>
-
createAssociation
@NonNull protected org.springframework.data.mapping.Association<SpannerPersistentProperty> createAssociation()- Specified by:
createAssociation
in 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 theFieldNamingStrategy
passed in to theSpannerPersistentPropertyImpl(Property, PersistentEntity, SimpleTypeHolder, FieldNamingStrategy)
constructor. This is by default the by default- Specified by:
getColumnName
in interfaceSpannerPersistentProperty
- Returns:
- the name of the column.
- Throws:
org.springframework.data.mapping.MappingException
- if the resolution fails
-
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.
-
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.
-
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.
-
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:
-
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.
-
isIdProperty
public boolean isIdProperty()- Specified by:
isIdProperty
in interfaceorg.springframework.data.mapping.PersistentProperty<SpannerPersistentProperty>
- Overrides:
isIdProperty
in classorg.springframework.data.mapping.model.AnnotationBasedPersistentProperty<SpannerPersistentProperty>
-
equals
- Overrides:
equals
in classorg.springframework.data.mapping.model.AbstractPersistentProperty<SpannerPersistentProperty>
-
hashCode
public int hashCode()- Overrides:
hashCode
in classorg.springframework.data.mapping.model.AbstractPersistentProperty<SpannerPersistentProperty>
-