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
Interface for processors that can populate fields from Spanner Structs and write them to Spanner
Mutations.
- Since:
- 1.1
-
Method Summary
Modifier and TypeMethodDescriptionClass<?>
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>
Converts a set of SpannerResultSet
into a list of objects.<T> List<T>
mapToList
(com.google.cloud.spanner.ResultSet resultSet, Class<T> entityClass, String... includeColumns) Converts a set of SpannerResultSet
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 SpannerResultSet
into a list of objects.default <R> R
<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
Converts a set of SpannerResultSet
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 SpannerResultSet
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 SpannerResultSet
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
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
-
read
- Specified by:
read
in interfaceorg.springframework.data.convert.EntityReader<Object,
com.google.cloud.spanner.Struct>
-