Class SpannerConverters
java.lang.Object
com.google.cloud.spring.data.spanner.core.convert.SpannerConverters
Default commonly-used custom converters.
- Since:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.springframework.core.convert.converter.Converter<Date,com.google.cloud.Timestamp> A converter fromDateto the Spanner timestamp type.static final Collection<org.springframework.core.convert.converter.Converter>Converters from common types to those used by Spanner.static final Collection<org.springframework.core.convert.converter.Converter>Converters from common types to those used by Spanner.static final org.springframework.core.convert.converter.Converter<Instant,com.google.cloud.Timestamp> A converter fromInstantto the Spanner instantaneous time type.static final org.springframework.core.convert.converter.Converter<Date,com.google.cloud.Date> A converter fromDateto the Spanner date type.static final org.springframework.core.convert.converter.Converter<byte[],com.google.cloud.ByteArray> A converter from a byte array to the Spanner bytes type.static final org.springframework.core.convert.converter.Converter<Timestamp,com.google.cloud.Timestamp> A converter fromTimestampto the Spanner instantaneous time type.static final org.springframework.core.convert.converter.Converter<LocalDateTime,com.google.cloud.Timestamp> A converter fromLocalDateTimeto the Spanner timestamp type.static final org.springframework.core.convert.converter.Converter<LocalDate,com.google.cloud.Date> A converter fromLocalDateto the Spanner date type.static final org.springframework.core.convert.converter.Converter<com.google.cloud.ByteArray,byte[]> A converter from the Spanner bytes type to a byte array.static final org.springframework.core.convert.converter.Converter<com.google.cloud.Date,Date> A converter from the Spanner date type toDate.static final org.springframework.core.convert.converter.Converter<com.google.cloud.Timestamp,Timestamp> A converter from the Spanner instantaneous time type toTimestamp.static final org.springframework.core.convert.converter.Converter<com.google.cloud.Timestamp,Date> A converter from the Spanner timestamp type toDate.static final org.springframework.core.convert.converter.Converter<com.google.cloud.Timestamp,Instant> A converter from the Spanner instantaneous time type toInstant.static final org.springframework.core.convert.converter.Converter<com.google.cloud.Date,LocalDate> A converter from the Spanner date type toLocalDate.static final org.springframework.core.convert.converter.Converter<com.google.cloud.Timestamp,LocalDateTime> A converter from the Spanner timestamp type toLocalDateTime. -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.cloud.TimestamptoTimestamp(Timestamp timestamp) A utility function to convert aTimestampvalue to theTimestamp.
-
Field Details
-
JAVA_SQL_TO_SPANNER_DATE_CONVERTER
public static final org.springframework.core.convert.converter.Converter<Date,com.google.cloud.Date> JAVA_SQL_TO_SPANNER_DATE_CONVERTERA converter fromDateto the Spanner date type. -
SPANNER_TO_JAVA_SQL_DATE_CONVERTER
public static final org.springframework.core.convert.converter.Converter<com.google.cloud.Date,Date> SPANNER_TO_JAVA_SQL_DATE_CONVERTERA converter from the Spanner date type toDate. -
LOCAL_DATE_TIMESTAMP_CONVERTER
public static final org.springframework.core.convert.converter.Converter<LocalDate,com.google.cloud.Date> LOCAL_DATE_TIMESTAMP_CONVERTERA converter fromLocalDateto the Spanner date type. -
TIMESTAMP_LOCAL_DATE_CONVERTER
public static final org.springframework.core.convert.converter.Converter<com.google.cloud.Date,LocalDate> TIMESTAMP_LOCAL_DATE_CONVERTERA converter from the Spanner date type toLocalDate. -
LOCAL_DATE_TIME_TIMESTAMP_CONVERTER
public static final org.springframework.core.convert.converter.Converter<LocalDateTime,com.google.cloud.Timestamp> LOCAL_DATE_TIME_TIMESTAMP_CONVERTERA converter fromLocalDateTimeto the Spanner timestamp type. -
TIMESTAMP_LOCAL_DATE_TIME_CONVERTER
public static final org.springframework.core.convert.converter.Converter<com.google.cloud.Timestamp,LocalDateTime> TIMESTAMP_LOCAL_DATE_TIME_CONVERTERA converter from the Spanner timestamp type toLocalDateTime. -
DATE_TIMESTAMP_CONVERTER
public static final org.springframework.core.convert.converter.Converter<Date,com.google.cloud.Timestamp> DATE_TIMESTAMP_CONVERTERA converter fromDateto the Spanner timestamp type. -
TIMESTAMP_DATE_CONVERTER
public static final org.springframework.core.convert.converter.Converter<com.google.cloud.Timestamp,Date> TIMESTAMP_DATE_CONVERTERA converter from the Spanner timestamp type toDate. -
INSTANT_TIMESTAMP_CONVERTER
public static final org.springframework.core.convert.converter.Converter<Instant,com.google.cloud.Timestamp> INSTANT_TIMESTAMP_CONVERTERA converter fromInstantto the Spanner instantaneous time type. -
TIMESTAMP_INSTANT_CONVERTER
public static final org.springframework.core.convert.converter.Converter<com.google.cloud.Timestamp,Instant> TIMESTAMP_INSTANT_CONVERTERA converter from the Spanner instantaneous time type toInstant. -
JAVA_TO_SPANNER_TIMESTAMP_CONVERTER
public static final org.springframework.core.convert.converter.Converter<Timestamp,com.google.cloud.Timestamp> JAVA_TO_SPANNER_TIMESTAMP_CONVERTERA converter fromTimestampto the Spanner instantaneous time type. -
SPANNER_TO_JAVA_TIMESTAMP_CONVERTER
public static final org.springframework.core.convert.converter.Converter<com.google.cloud.Timestamp,Timestamp> SPANNER_TO_JAVA_TIMESTAMP_CONVERTERA converter from the Spanner instantaneous time type toTimestamp. -
JAVA_TO_SPANNER_BYTE_ARRAY_CONVERTER
public static final org.springframework.core.convert.converter.Converter<byte[],com.google.cloud.ByteArray> JAVA_TO_SPANNER_BYTE_ARRAY_CONVERTERA converter from a byte array to the Spanner bytes type. -
SPANNER_TO_JAVA_BYTE_ARRAY_CONVERTER
public static final org.springframework.core.convert.converter.Converter<com.google.cloud.ByteArray,byte[]> SPANNER_TO_JAVA_BYTE_ARRAY_CONVERTERA converter from the Spanner bytes type to a byte array. -
DEFAULT_SPANNER_WRITE_CONVERTERS
public static final Collection<org.springframework.core.convert.converter.Converter> DEFAULT_SPANNER_WRITE_CONVERTERSConverters from common types to those used by Spanner. -
DEFAULT_SPANNER_READ_CONVERTERS
public static final Collection<org.springframework.core.convert.converter.Converter> DEFAULT_SPANNER_READ_CONVERTERSConverters from common types to those used by Spanner.
-
-
Method Details
-
toTimestamp
A utility function to convert aTimestampvalue to theTimestamp.- Parameters:
timestamp- the value to convert- Returns:
- the equivalent Timestamp value
-