Package com.google.cloud.bigquery
Class QueryParameterValue
java.lang.Object
com.google.cloud.bigquery.QueryParameterValue
- All Implemented Interfaces:
Serializable
A value for a QueryParameter along with its type.
A static factory method is provided for each of the possible types (e.g. int64(Long)
for StandardSQLTypeName.INT64). Alternatively, an instance can be constructed by calling of(Object, Class) with the value and a Class object, which will use these mappings:
- Boolean: StandardSQLTypeName.BOOL
- String: StandardSQLTypeName.STRING
- Integer: StandardSQLTypeName.INT64
- Long: StandardSQLTypeName.INT64
- Double: StandardSQLTypeName.FLOAT64
- Float: StandardSQLTypeName.FLOAT64
- BigDecimal: StandardSQLTypeName.NUMERIC
- BigNumeric: StandardSQLTypeName.BIGNUMERIC
- JSON: StandardSQLTypeName.JSON
- INTERVAL: StandardSQLTypeName.INTERVAL
No other types are supported through that entry point. The other types can be created by
calling of(Object, StandardSQLTypeName) with the value and a particular
StandardSQLTypeName enum value.
Struct parameters are currently not supported.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> QueryParameterValuearray(T[] array, StandardSQLTypeName type) Creates aQueryParameterValueobject with a type of ARRAY the given array element type.static <T> QueryParameterValueCreates aQueryParameterValueobject with a type of ARRAY, and an array element type based on the given class.static QueryParameterValuebigNumeric(BigDecimal value) Creates aQueryParameterValueobject with a type of BIGNUMERIC.static QueryParameterValueCreates aQueryParameterValueobject with a type of BOOL.static QueryParameterValuebytes(byte[] value) Creates aQueryParameterValueobject with a type of BYTES.static QueryParameterValueCreates aQueryParameterValueobject with a type of DATE.static QueryParameterValueCreates aQueryParameterValueobject with a type of DATETIME.static QueryParameterValueCreates aQueryParameterValueobject with a type of FLOAT64.static QueryParameterValueCreates aQueryParameterValueobject with a type of FLOAT64.static QueryParameterValueCreates aQueryParameterValueobject with a type of GEOGRAPHY.abstract StandardSQLTypeNameReturns the data type of the array elements.Returns the array values of this parameter.Returns the data type of the struct elements.Returns the struct values of this parameter.abstract StandardSQLTypeNamegetType()Returns the data type of this parameter.abstract StringgetValue()Returns the value of this parameter.static QueryParameterValueCreates aQueryParameterValueobject with a type of INT64.static QueryParameterValueCreates aQueryParameterValueobject with a type of INT64.static QueryParameterValueCreates aQueryParameterValueobject with a type of INTERVAL.static QueryParameterValueinterval(org.threeten.extra.PeriodDuration value) Creates aQueryParameterValueobject with a type of INTERVAL.static QueryParameterValuejson(com.google.gson.JsonObject value) Creates aQueryParameterValueobject with a type of JSON.static QueryParameterValueCreates aQueryParameterValueobject with a type of JSON.static QueryParameterValue.BuilderReturns a builder for theQueryParameterValueobject.static QueryParameterValuenumeric(BigDecimal value) Creates aQueryParameterValueobject with a type of NUMERIC.static <T> QueryParameterValueof(T value, StandardSQLTypeName type) Creates aQueryParameterValueobject with the given value and type.static <T> QueryParameterValueCreates aQueryParameterValueobject with the given value and type.static QueryParameterValueCreates aQueryParameterValueobject with a type of STRING.static QueryParameterValuestruct(Map<String, QueryParameterValue> struct) Creates a map withQueryParameterValueobject and a type of STRUCT the given struct element type.static QueryParameterValueCreates aQueryParameterValueobject with a type of TIME.static QueryParameterValueCreates aQueryParameterValueobject with a type of TIMESTAMP.static QueryParameterValueCreates aQueryParameterValueobject with a type of TIMESTAMP.abstract QueryParameterValue.BuilderReturns a builder for a QueryParameterValue object with given value.
-
Method Details
-
getValue
Returns the value of this parameter. -
getArrayValues
Returns the array values of this parameter. The returned list, if not null, is immutable. -
getStructValues
Returns the struct values of this parameter. The returned map, if not null, is immutable. -
getType
Returns the data type of this parameter. -
getArrayType
Returns the data type of the array elements. -
getStructTypes
Returns the data type of the struct elements. -
of
Creates aQueryParameterValueobject with the given value and type. Note: this does not support BigNumeric -
of
Creates aQueryParameterValueobject with the given value and type. -
bool
Creates aQueryParameterValueobject with a type of BOOL. -
int64
Creates aQueryParameterValueobject with a type of INT64. -
int64
Creates aQueryParameterValueobject with a type of INT64. -
float64
Creates aQueryParameterValueobject with a type of FLOAT64. -
float64
Creates aQueryParameterValueobject with a type of FLOAT64. -
numeric
Creates aQueryParameterValueobject with a type of NUMERIC. -
bigNumeric
Creates aQueryParameterValueobject with a type of BIGNUMERIC. -
string
Creates aQueryParameterValueobject with a type of STRING. -
geography
Creates aQueryParameterValueobject with a type of GEOGRAPHY. -
json
Creates aQueryParameterValueobject with a type of JSON. Currently, this is only supported in INSERT, not in query as a filter -
json
Creates aQueryParameterValueobject with a type of JSON. Currently, this is only supported in INSERT, not in query as a filter -
bytes
Creates aQueryParameterValueobject with a type of BYTES. -
timestamp
Creates aQueryParameterValueobject with a type of TIMESTAMP. -
timestamp
Creates aQueryParameterValueobject with a type of TIMESTAMP. Must be in the format "yyyy-MM-dd HH:mm:ss.SSSSSSZZ", e.g. "2014-08-19 12:41:35.220000+00:00". -
date
Creates aQueryParameterValueobject with a type of DATE. Must be in the format "yyyy-MM-dd", e.g. "2014-08-19". -
time
Creates aQueryParameterValueobject with a type of TIME. Must be in the format "HH:mm:ss.SSSSSS", e.g. "12:41:35.220000". -
dateTime
Creates aQueryParameterValueobject with a type of DATETIME. Must be in the format "yyyy-MM-dd HH:mm:ss.SSSSSS", e.g. "2014-08-19 12:41:35.220000". -
interval
Creates aQueryParameterValueobject with a type of INTERVAL. Must be in the canonical format "[sign]Y-M [sign]D [sign]H:M:S[.F]", e.g. "123-7 -19 0:24:12.000006" or ISO 8601 duration format, e.g. "P123Y7M-19DT0H24M12.000006S" -
interval
Creates aQueryParameterValueobject with a type of INTERVAL. -
array
Creates aQueryParameterValueobject with a type of ARRAY, and an array element type based on the given class. -
array
Creates aQueryParameterValueobject with a type of ARRAY the given array element type. -
struct
Creates a map withQueryParameterValueobject and a type of STRUCT the given struct element type. -
toBuilder
Returns a builder for a QueryParameterValue object with given value. -
newBuilder
Returns a builder for theQueryParameterValueobject.
-