public class MappingSpannerConverter extends Object implements SpannerConverter
Constructor and Description |
---|
MappingSpannerConverter(SpannerMappingContext spannerMappingContext) |
MappingSpannerConverter(SpannerMappingContext spannerMappingContext,
Collection<org.springframework.core.convert.converter.Converter> writeConverters,
Collection<org.springframework.core.convert.converter.Converter> readConverters) |
MappingSpannerConverter(SpannerMappingContext spannerMappingContext,
org.springframework.data.convert.CustomConversions writeConversions,
org.springframework.data.convert.CustomConversions readConversions) |
Modifier and Type | Method and Description |
---|---|
<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)
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. |
<R> R |
read(Class<R> type,
com.google.cloud.spanner.Struct source) |
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.
|
public MappingSpannerConverter(SpannerMappingContext spannerMappingContext)
public MappingSpannerConverter(SpannerMappingContext spannerMappingContext, Collection<org.springframework.core.convert.converter.Converter> writeConverters, Collection<org.springframework.core.convert.converter.Converter> readConverters)
public MappingSpannerConverter(SpannerMappingContext spannerMappingContext, org.springframework.data.convert.CustomConversions writeConversions, org.springframework.data.convert.CustomConversions readConversions)
public <T> List<T> mapToList(com.google.cloud.spanner.ResultSet resultSet, Class<T> entityClass)
SpannerConverter
ResultSet
into a list of objects.mapToList
in interface SpannerConverter
T
- 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)
SpannerConverter
ResultSet
into a list of objects.mapToList
in interface SpannerConverter
T
- 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.public <T> List<T> mapToList(com.google.cloud.spanner.ResultSet resultSet, Class<T> entityClass, String... includeColumns)
SpannerConverter
ResultSet
into a list of objects.mapToList
in interface SpannerConverter
T
- 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 void write(Object source, com.google.cloud.spanner.Mutation.WriteBuilder sink, Set<String> includeColumns)
SpannerConverter
write
in interface SpannerConverter
source
- the object to writesink
- the sink to which to writeincludeColumns
- the properties/columns to write. If null, then all columns
are written.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.Copyright © 2018 Pivotal Software, Inc.. All rights reserved.