public class ConverterAwareMappingSpannerEntityWriter extends Object implements SpannerEntityWriter
Mutation.WriteBuilder
for the
purpose of creating mutations for Spanner.Modifier and Type | Field and Description |
---|---|
static Map<Class<?>,BiFunction<ValueBinder,?,?>> |
singleItemTypeValueBinderMethodMap
A map of types to functions that binds them to `ValueBinder` objects.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
attemptBindSingleValue(Object propertyValue,
Class<?> propertyType,
ValueBinder valueBinder,
SpannerCustomConverter spannerCustomConverter)
Bind a value to a ValueBinder.
|
static boolean |
attemptSetIterableValueOnBinder(Iterable<Object> value,
ValueBinder valueBinder,
SpannerCustomConverter writeConverter,
Class innerType)
Bind an iterable value to a ValueBinder.
|
Key |
convertToKey(Object key)
Convert a given object to a Cloud Spanner key.
|
static Class<?> |
findFirstCompatibleSpannerMultipleItemNativeType(Predicate<Class> testFunc) |
static Class<?> |
findFirstCompatibleSpannerSingleItemNativeType(Predicate<Class> testFunc) |
SpannerWriteConverter |
getSpannerWriteConverter()
Get the SpannerWriteConverter used to convert types into Cloud Spanner compatible
types.
|
void |
write(Object source,
MultipleValueBinder sink) |
void |
write(Object source,
MultipleValueBinder sink,
Set<String> includeColumns)
Writes an object's properties to the sink.
|
public static final Map<Class<?>,BiFunction<ValueBinder,?,?>> singleItemTypeValueBinderMethodMap
public static Class<?> findFirstCompatibleSpannerSingleItemNativeType(Predicate<Class> testFunc)
public static Class<?> findFirstCompatibleSpannerMultipleItemNativeType(Predicate<Class> testFunc)
public void write(Object source, MultipleValueBinder sink)
write
in interface org.springframework.data.convert.EntityWriter<Object,MultipleValueBinder>
public void write(Object source, MultipleValueBinder sink, Set<String> includeColumns)
write
in interface SpannerEntityWriter
source
- the object to writesink
- the sink to which to writeincludeColumns
- the columns to write. If null, then all columns are written.public Key convertToKey(Object key)
SpannerEntityWriter
convertToKey
in interface SpannerEntityWriter
key
- the object containing the key values. This can already be a Cloud Spanner
key, a single key component, or an array of key components.public SpannerWriteConverter getSpannerWriteConverter()
SpannerEntityWriter
getSpannerWriteConverter
in interface SpannerEntityWriter
public static boolean attemptSetIterableValueOnBinder(Iterable<Object> value, ValueBinder valueBinder, SpannerCustomConverter writeConverter, Class innerType)
value
- the value to bind.valueBinder
- the binder that accepts the value.writeConverter
- the converter to use to convert the values.innerType
- the type of the items in the iterable.true
if the binding was successful.public static boolean attemptBindSingleValue(Object propertyValue, Class<?> propertyType, ValueBinder valueBinder, SpannerCustomConverter spannerCustomConverter)
propertyValue
- the value to bind.propertyType
- the type of the value to bind.valueBinder
- the binder.spannerCustomConverter
- the converter used to convert if necessary.true
if the value was bound successfully.Copyright © 2020 Pivotal Software, Inc.. All rights reserved.