Class ValueBinder<R>

java.lang.Object
com.google.cloud.spanner.ValueBinder<R>
Type Parameters:
R - The context which is used to bind the Value.

public abstract class ValueBinder<R> extends Object
An interface for binding a Value in some context. Users of the Cloud Spanner client library never create a ValueBinder directly; instead this interface is returned from other parts of the library involved in Value construction. For example, Mutation.WriteBuilder.set(String) returns a binder to bind a column value, and Statement#bind(String) returns a binder to bind a parameter to a value.

ValueBinder subclasses typically carry state and are therefore not thread-safe, although the core implementation itself is thread-safe.

  • Method Summary

    Modifier and Type
    Method
    Description
    to(boolean value)
    Binds to Value.bool(value)
    to(double value)
    Binds to Value.float64(value)
    to(long value)
    Binds to Value.int64(value)
    to(long v, String protoTypFqn)
    Binds to Value.protoEnum(value, protoType)
    to(com.google.cloud.ByteArray value)
    Binds to Value.bytes(value).
    to(com.google.cloud.ByteArray v, com.google.protobuf.Descriptors.Descriptor descriptor)
    Binds to Value.protoMessage(value, descriptor)
    to(com.google.cloud.ByteArray v, String protoTypFqn)
    Binds to Value.protoMessage(value, protoType)
    to(com.google.cloud.Date value)
    Binds to Value.date(value)
    to(Struct value)
    Binds a non-NULL struct value to Value.struct(value)
    to(Type type, Struct value)
    Binds a nullable Struct reference with given Type to Value.struct(type,value
    to(Value value)
    Binds a Value
    to(com.google.cloud.Timestamp value)
    Binds to Value.timestamp(value)
    to(com.google.protobuf.AbstractMessage m)
    Binds to Value.protoMessage(value)
    to(com.google.protobuf.ProtocolMessageEnum value)
    Binds to Value.protoEnum(value)
    to(Boolean value)
    Binds to Value.bool(value)
    to(Double value)
    Binds to Value.float64(value)
    to(Long value)
    Binds to Value.int64(value)
    to(Long v, com.google.protobuf.Descriptors.EnumDescriptor enumDescriptor)
    Binds to Value.protoEnum(value, enumDescriptor)
    to(Long v, String protoTypFqn)
    Binds to Value.protoEnum(value, protoType)
    to(String value)
    Binds to Value.string(value)
    to(BigDecimal value)
    Binds to Value.numeric(value)
    toBoolArray(boolean[] values)
    Binds to Value.boolArray(values)
    toBoolArray(boolean[] values, int pos, int length)
    Binds to Value.boolArray(values, int, pos)
    Binds to Value.boolArray(values)
    toBytesArray(Iterable<com.google.cloud.ByteArray> values)
    Binds to Value.bytesArray(values)
    toBytesArrayFromBase64(Iterable<String> valuesAsBase64Strings)
    Binds to Value.bytesArray(values).
    toDateArray(Iterable<com.google.cloud.Date> values)
    Binds to Value.dateArray(values)
    toFloat64Array(double[] values)
    Binds to Value.float64Array(values)
    toFloat64Array(double[] values, int pos, int length)
    Binds to Value.float64Array(values, pos, length)
    Binds to Value.float64Array(values)
    toInt64Array(long[] values)
    Binds to Value.int64Array(values)
    toInt64Array(long[] values, int pos, int length)
    Binds to Value.int64Array(values, pos, length)
    Binds to Value.int64Array(values)
    Binds to Value.jsonArray(values)
    Binds to Value.numericArray(values)
    Binds to Value.jsonbArray(values)
    Binds to Value.pgNumericArray(values)
    toProtoEnumArray(Iterable<com.google.protobuf.ProtocolMessageEnum> values, com.google.protobuf.Descriptors.EnumDescriptor descriptor)
    Binds to Value.protoEnumArray(values, descriptor)
    toProtoEnumArray(Iterable<Long> values, String protoTypeFq)
    Binds to Value.protoEnumArray(values, protoTypeFq)
    toProtoMessageArray(Iterable<com.google.cloud.ByteArray> values, String protoTypeFq)
    Binds to Value.protoMessageArray(values, protoTypeFq)
    toProtoMessageArray(Iterable<com.google.protobuf.AbstractMessage> values, com.google.protobuf.Descriptors.Descriptor descriptor)
    Binds to Value.protoMessageArray(values, descriptor)
    Binds to Value.stringArray(values)
    toStructArray(Type elementType, Iterable<Struct> values)
    Binds to Value.structArray(fieldTypes, values)
    toTimestampArray(Iterable<com.google.cloud.Timestamp> values)
    Binds to Value.timestampArray(values)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • to

      public R to(Value value)
      Binds a Value
    • to

      public R to(boolean value)
      Binds to Value.bool(value)
    • to

      public R to(@Nullable Boolean value)
      Binds to Value.bool(value)
    • to

      public R to(long value)
      Binds to Value.int64(value)
    • to

      public R to(@Nullable Long value)
      Binds to Value.int64(value)
    • to

      public R to(double value)
      Binds to Value.float64(value)
    • to

      public R to(@Nullable Double value)
      Binds to Value.float64(value)
    • to

      public R to(BigDecimal value)
      Binds to Value.numeric(value)
    • to

      public R to(@Nullable String value)
      Binds to Value.string(value)
    • to

      public R to(com.google.protobuf.AbstractMessage m)
      Binds to Value.protoMessage(value)
    • to

      public R to(@Nullable com.google.cloud.ByteArray v, String protoTypFqn)
      Binds to Value.protoMessage(value, protoType)
    • to

      public R to(@Nullable com.google.cloud.ByteArray v, com.google.protobuf.Descriptors.Descriptor descriptor)
      Binds to Value.protoMessage(value, descriptor)
    • to

      public R to(com.google.protobuf.ProtocolMessageEnum value)
      Binds to Value.protoEnum(value)
    • to

      public R to(@Nullable Long v, String protoTypFqn)
      Binds to Value.protoEnum(value, protoType)
    • to

      public R to(@Nullable Long v, com.google.protobuf.Descriptors.EnumDescriptor enumDescriptor)
      Binds to Value.protoEnum(value, enumDescriptor)
    • to

      public R to(long v, String protoTypFqn)
      Binds to Value.protoEnum(value, protoType)
    • to

      public R to(@Nullable com.google.cloud.ByteArray value)
      Binds to Value.bytes(value). Use to(Value) in combination with Value.bytesFromBase64(String) if you already have the value that you want to bind in base64 format. This prevents unnecessary decoding and encoding of base64 strings.
    • to

      public R to(@Nullable com.google.cloud.Timestamp value)
      Binds to Value.timestamp(value)
    • to

      public R to(@Nullable com.google.cloud.Date value)
      Binds to Value.date(value)
    • to

      public R to(Struct value)
      Binds a non-NULL struct value to Value.struct(value)
    • to

      public R to(Type type, @Nullable Struct value)
      Binds a nullable Struct reference with given Type to Value.struct(type,value
    • toBoolArray

      public R toBoolArray(@Nullable boolean[] values)
      Binds to Value.boolArray(values)
    • toBoolArray

      public R toBoolArray(@Nullable boolean[] values, int pos, int length)
      Binds to Value.boolArray(values, int, pos)
    • toBoolArray

      public R toBoolArray(@Nullable Iterable<Boolean> values)
      Binds to Value.boolArray(values)
    • toInt64Array

      public R toInt64Array(@Nullable long[] values)
      Binds to Value.int64Array(values)
    • toInt64Array

      public R toInt64Array(@Nullable long[] values, int pos, int length)
      Binds to Value.int64Array(values, pos, length)
    • toInt64Array

      public R toInt64Array(@Nullable Iterable<Long> values)
      Binds to Value.int64Array(values)
    • toFloat64Array

      public R toFloat64Array(@Nullable double[] values)
      Binds to Value.float64Array(values)
    • toFloat64Array

      public R toFloat64Array(@Nullable double[] values, int pos, int length)
      Binds to Value.float64Array(values, pos, length)
    • toFloat64Array

      public R toFloat64Array(@Nullable Iterable<Double> values)
      Binds to Value.float64Array(values)
    • toNumericArray

      public R toNumericArray(@Nullable Iterable<BigDecimal> values)
      Binds to Value.numericArray(values)
    • toPgNumericArray

      public R toPgNumericArray(@Nullable Iterable<String> values)
      Binds to Value.pgNumericArray(values)
    • toStringArray

      public R toStringArray(@Nullable Iterable<String> values)
      Binds to Value.stringArray(values)
    • toJsonArray

      public R toJsonArray(@Nullable Iterable<String> values)
      Binds to Value.jsonArray(values)
    • toPgJsonbArray

      public R toPgJsonbArray(@Nullable Iterable<String> values)
      Binds to Value.jsonbArray(values)
    • toBytesArray

      public R toBytesArray(@Nullable Iterable<com.google.cloud.ByteArray> values)
      Binds to Value.bytesArray(values)
    • toBytesArrayFromBase64

      public R toBytesArrayFromBase64(@Nullable Iterable<String> valuesAsBase64Strings)
      Binds to Value.bytesArray(values). The given strings must be valid base64 encoded strings. Use this method instead of toBytesArray(Iterable) if you already have the values in base64 format to prevent unnecessary decoding and encoding to/from base64.
    • toTimestampArray

      public R toTimestampArray(@Nullable Iterable<com.google.cloud.Timestamp> values)
      Binds to Value.timestampArray(values)
    • toProtoMessageArray

      public R toProtoMessageArray(@Nullable Iterable<com.google.protobuf.AbstractMessage> values, com.google.protobuf.Descriptors.Descriptor descriptor)
      Binds to Value.protoMessageArray(values, descriptor)
    • toProtoMessageArray

      public R toProtoMessageArray(@Nullable Iterable<com.google.cloud.ByteArray> values, String protoTypeFq)
      Binds to Value.protoMessageArray(values, protoTypeFq)
    • toProtoEnumArray

      public R toProtoEnumArray(@Nullable Iterable<com.google.protobuf.ProtocolMessageEnum> values, com.google.protobuf.Descriptors.EnumDescriptor descriptor)
      Binds to Value.protoEnumArray(values, descriptor)
    • toProtoEnumArray

      public R toProtoEnumArray(@Nullable Iterable<Long> values, String protoTypeFq)
      Binds to Value.protoEnumArray(values, protoTypeFq)
    • toDateArray

      public R toDateArray(@Nullable Iterable<com.google.cloud.Date> values)
      Binds to Value.dateArray(values)
    • toStructArray

      public R toStructArray(Type elementType, @Nullable Iterable<Struct> values)
      Binds to Value.structArray(fieldTypes, values)