Interface SpannerEntityProcessor

All Superinterfaces:
org.springframework.data.convert.EntityReader<Object,com.google.cloud.spanner.Struct>, org.springframework.data.convert.EntityWriter<Object,MultipleValueBinder>, SpannerEntityWriter
All Known Implementing Classes:
ConverterAwareMappingSpannerEntityProcessor

public interface SpannerEntityProcessor extends SpannerEntityWriter
Interface for processors that can populate fields from Spanner Structs and write them to Spanner Mutations.
Since:
1.1
  • Method Summary

    Modifier and Type
    Method
    Description
    getCorrespondingSpannerJavaType(Class originalType, boolean isIterableInnerType)
    Gets the type that will work for both read and writes with Spanner directly.
    Get the read converter used by this processor.
    Get the write converter used by this processor.
    <T> List<T>
    mapToList(com.google.cloud.spanner.ResultSet resultSet, Class<T> entityClass)
    Converts a set of Spanner ResultSet into a list of objects.
    <T> List<T>
    mapToList(com.google.cloud.spanner.ResultSet resultSet, Class<T> entityClass, String... includeColumns)
    Converts a set of Spanner ResultSet into a list of objects.
    <T> List<T>
    mapToList(com.google.cloud.spanner.ResultSet resultSet, Class<T> entityClass, Set<String> includeColumns, boolean allowMissingColumns)
    Converts a Spanner ResultSet into a list of objects.
    default <R> R
    read(Class<R> type, com.google.cloud.spanner.Struct source)
     
    <R> R
    read(Class<R> type, com.google.cloud.spanner.Struct source, Set<String> includeColumns, boolean allowMissingColumns)
     

    Methods inherited from interface org.springframework.data.convert.EntityWriter

    write

    Methods inherited from interface com.google.cloud.spring.data.spanner.core.convert.SpannerEntityWriter

    convertToKey, getSpannerWriteConverter, write
  • Method Details

    • mapToList

      <T> List<T> mapToList(com.google.cloud.spanner.ResultSet resultSet, Class<T> entityClass)
      Converts a set of Spanner ResultSet into a list of objects.
      Type Parameters:
      T - the type of the objects the Spanner results represent.
      Parameters:
      resultSet - the Spanner results to convert. The ResultSet will be exhausted and closed.
      entityClass - the type of the objects the Spanner results represent.
      Returns:
      a list of objects.
    • mapToList

      <T> List<T> mapToList(com.google.cloud.spanner.ResultSet resultSet, Class<T> entityClass, Set<String> includeColumns, boolean allowMissingColumns)
      Converts a Spanner ResultSet into a list of objects.
      Type Parameters:
      T - the type of the objects the Spanner results represent.
      Parameters:
      resultSet - the Spanner results to convert. The ResultSet will be exhausted and closed.
      entityClass - the type of the objects the Spanner results represent.
      includeColumns - the Set of columns to read. If this param is null then all columns will be read.
      allowMissingColumns - if true, then properties with no corresponding column are not mapped. If false, then an exception is thrown.
      Returns:
      a list of objects.
    • mapToList

      <T> List<T> mapToList(com.google.cloud.spanner.ResultSet resultSet, Class<T> entityClass, String... includeColumns)
      Converts a set of Spanner ResultSet into a list of objects.
      Type Parameters:
      T - the type of the objects the Spanner results represent.
      Parameters:
      resultSet - the Spanner results to convert. The ResultSet will be exhausted and closed.
      entityClass - the type of the objects the Spanner results represent.
      includeColumns - the columns to read. If none are provided then all columns are read.
      Returns:
      a list of objects.
    • getCorrespondingSpannerJavaType

      Class<?> getCorrespondingSpannerJavaType(Class originalType, boolean isIterableInnerType)
      Gets the type that will work for both read and writes with Spanner directly.
      Parameters:
      originalType - the original type that is possibly convertable by this converter.
      isIterableInnerType - true if the given type refers to an inner type. This is significant because Spanner does not support the same types as singular items and as array elements.
      Returns:
      the Java type that works directly with Spanner.
    • getWriteConverter

      SpannerWriteConverter getWriteConverter()
      Get the write converter used by this processor.
      Returns:
      the write converter.
    • getReadConverter

      SpannerReadConverter getReadConverter()
      Get the read converter used by this processor.
      Returns:
      the read converter.
    • read

      <R> R read(Class<R> type, com.google.cloud.spanner.Struct source, Set<String> includeColumns, boolean allowMissingColumns)
    • read

      default <R> R read(Class<R> type, com.google.cloud.spanner.Struct source)
      Specified by:
      read in interface org.springframework.data.convert.EntityReader<Object,com.google.cloud.spanner.Struct>