Class SpannerConverters

java.lang.Object
com.google.cloud.spring.data.spanner.core.convert.SpannerConverters

public final class SpannerConverters extends Object
Default commonly-used custom converters.
Since:
1.1
  • 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_CONVERTER
      A converter from Date to 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_CONVERTER
      A converter from the Spanner date type to Date.
    • LOCAL_DATE_TIMESTAMP_CONVERTER

      public static final org.springframework.core.convert.converter.Converter<LocalDate,com.google.cloud.Date> LOCAL_DATE_TIMESTAMP_CONVERTER
      A converter from LocalDate to 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_CONVERTER
      A converter from the Spanner date type to LocalDate.
    • LOCAL_DATE_TIME_TIMESTAMP_CONVERTER

      public static final org.springframework.core.convert.converter.Converter<LocalDateTime,com.google.cloud.Timestamp> LOCAL_DATE_TIME_TIMESTAMP_CONVERTER
      A converter from LocalDateTime to 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_CONVERTER
      A converter from the Spanner timestamp type to LocalDateTime.
    • DATE_TIMESTAMP_CONVERTER

      public static final org.springframework.core.convert.converter.Converter<Date,com.google.cloud.Timestamp> DATE_TIMESTAMP_CONVERTER
      A converter from Date to the Spanner timestamp type.
    • TIMESTAMP_DATE_CONVERTER

      public static final org.springframework.core.convert.converter.Converter<com.google.cloud.Timestamp,Date> TIMESTAMP_DATE_CONVERTER
      A converter from the Spanner timestamp type to Date.
    • INSTANT_TIMESTAMP_CONVERTER

      public static final org.springframework.core.convert.converter.Converter<Instant,com.google.cloud.Timestamp> INSTANT_TIMESTAMP_CONVERTER
      A converter from Instant to the Spanner instantaneous time type.
    • TIMESTAMP_INSTANT_CONVERTER

      public static final org.springframework.core.convert.converter.Converter<com.google.cloud.Timestamp,Instant> TIMESTAMP_INSTANT_CONVERTER
      A converter from the Spanner instantaneous time type to Instant.
    • JAVA_TO_SPANNER_TIMESTAMP_CONVERTER

      public static final org.springframework.core.convert.converter.Converter<Timestamp,com.google.cloud.Timestamp> JAVA_TO_SPANNER_TIMESTAMP_CONVERTER
      A converter from Timestamp to 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_CONVERTER
      A converter from the Spanner instantaneous time type to Timestamp.
    • 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_CONVERTER
      A 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_CONVERTER
      A 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_CONVERTERS
      Converters 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_CONVERTERS
      Converters from common types to those used by Spanner.
  • Method Details

    • toTimestamp

      public static com.google.cloud.Timestamp toTimestamp(@NonNull Timestamp timestamp)
      A utility function to convert a Timestamp value to the Timestamp.
      Parameters:
      timestamp - the value to convert
      Returns:
      the equivalent Timestamp value