public class ConverterAwareMappingSpannerEntityProcessor extends Object implements SpannerEntityProcessor
| Constructor and Description |
|---|
ConverterAwareMappingSpannerEntityProcessor(SpannerMappingContext spannerMappingContext) |
ConverterAwareMappingSpannerEntityProcessor(SpannerMappingContext spannerMappingContext,
Collection<org.springframework.core.convert.converter.Converter> writeConverters,
Collection<org.springframework.core.convert.converter.Converter> readConverters) |
| Modifier and Type | Method and Description |
|---|---|
Class |
getCorrespondingSpannerJavaType(Class originalType,
boolean isIterableInnerType)
Gets the type that will work for both read and writes with Spanner directly.
|
<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,
Optional<Set<String>> includeColumns,
boolean allowMissingColumns)
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. |
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) |
void |
write(Object source,
com.google.cloud.spanner.Mutation.WriteBuilder sink)
Writes each of the source properties to the sink.
|
void |
write(Object source,
com.google.cloud.spanner.Mutation.WriteBuilder sink,
Set<String> includeColumns)
Writes an object's properties to the sink.
|
com.google.cloud.spanner.Key |
writeToKey(Object key) |
public ConverterAwareMappingSpannerEntityProcessor(SpannerMappingContext spannerMappingContext)
public ConverterAwareMappingSpannerEntityProcessor(SpannerMappingContext spannerMappingContext, Collection<org.springframework.core.convert.converter.Converter> writeConverters, Collection<org.springframework.core.convert.converter.Converter> readConverters)
public <T> List<T> mapToList(com.google.cloud.spanner.ResultSet resultSet, Class<T> entityClass)
SpannerEntityProcessorResultSet into a list of objects.mapToList in interface SpannerEntityProcessorT - The type of the objects the Spanner results represent.resultSet - The Spanner results to convert. The ResultSet will be exhausted and
closed.entityClass - The type of the objects the Spanner results represent.public <T> List<T> mapToList(com.google.cloud.spanner.ResultSet resultSet, Class<T> entityClass, Optional<Set<String>> includeColumns, boolean allowMissingColumns)
SpannerEntityProcessorResultSet into a list of objects.mapToList in interface SpannerEntityProcessorT - The type of the objects the Spanner results represent.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 the Set is not present or 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.public <T> List<T> mapToList(com.google.cloud.spanner.ResultSet resultSet, Class<T> entityClass, String... includeColumns)
SpannerEntityProcessorResultSet into a list of objects.mapToList in interface SpannerEntityProcessorT - The type of the objects the Spanner results represent.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.public Class getCorrespondingSpannerJavaType(Class originalType, boolean isIterableInnerType)
SpannerEntityProcessorgetCorrespondingSpannerJavaType in interface SpannerEntityProcessororiginalType - 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.public void write(Object source, com.google.cloud.spanner.Mutation.WriteBuilder sink)
write in interface org.springframework.data.convert.EntityWriter<Object,com.google.cloud.spanner.Mutation.WriteBuilder>source - entity to be writtensink - the stateful Mutation.WriteBuilder as a target for writing.public void write(Object source, com.google.cloud.spanner.Mutation.WriteBuilder sink, Set<String> includeColumns)
SpannerEntityWriterwrite in interface SpannerEntityWritersource - the object to writesink - the sink to which to writeincludeColumns - the properties/columns to write. If null, then all columns are
written.public com.google.cloud.spanner.Key writeToKey(Object key)
writeToKey in interface SpannerEntityWriterpublic <R> R read(Class<R> type, com.google.cloud.spanner.Struct source, Set<String> includeColumns, boolean allowMissingColumns)
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.