Class ValueBinder<R>


  • 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 Detail

      • to

        public R to​(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​(BigDecimal value)
        Binds to Value.numeric(value)
      • 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)
      • 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)
      • 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)
      • toPgNumericArray

        public R toPgNumericArray​(@Nullable
                                  Iterable<String> values)
        Binds to Value.pgNumericArray(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)
      • 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)