Class FieldValue (2.34.2)

public class FieldValue implements Serializable

Google BigQuery Table Field Value class. Objects of this class represent values of a BigQuery Table Field. A list of values forms a table row. Tables rows can be gotten as the result of a query or when listing table data.

Inheritance

Object > FieldValue

Implements

Serializable

Static Methods

of(FieldValue.Attribute attribute, Object value)

public static FieldValue of(FieldValue.Attribute attribute, Object value)

Creates an instance of FieldValue, useful for testing.

If the attribute is Attribute#PRIMITIVE, the value should be the string representation of the underlying value, eg "123" for number 123.

If the attribute is Attribute#REPEATED or Attribute#RECORD, the value should be List of FieldValues or FieldValueList, respectively.

This method is unstable. See this discussion for more context.

Parameters
NameDescription
attributeFieldValue.Attribute
valueObject
Returns
TypeDescription
FieldValue

Methods

equals(Object obj)

public final boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getAttribute()

public FieldValue.Attribute getAttribute()

Returns the attribute of this Field Value.

Returns
TypeDescription
FieldValue.Attribute

Attribute#PRIMITIVE if the field is a primitive type (LegacySQLTypeName#BYTES, LegacySQLTypeName#BOOLEAN, LegacySQLTypeName#STRING, LegacySQLTypeName#FLOAT, LegacySQLTypeName#INTEGER, LegacySQLTypeName#NUMERIC, LegacySQLTypeName#TIMESTAMP, LegacySQLTypeName#GEOGRAPHY) or is null.

Returns Attribute#REPEATED if the corresponding field has (Field.Mode#REPEATED) mode. Returns Attribute#RECORD if the corresponding field is a LegacySQLTypeName#RECORD type.

getBooleanValue()

public boolean getBooleanValue()

Returns this field's value as a Boolean. This method should only be used if the corresponding field has LegacySQLTypeName#BOOLEAN type.

Returns
TypeDescription
boolean

getBytesValue()

public byte[] getBytesValue()

Returns this field's value as a byte array. This method should only be used if the corresponding field has primitive type (LegacySQLTypeName#BYTES.

Returns
TypeDescription
byte[]

getDoubleValue()

public double getDoubleValue()

Returns this field's value as a Double. This method should only be used if the corresponding field has LegacySQLTypeName#FLOAT type.

Returns
TypeDescription
double

getLongValue()

public long getLongValue()

Returns this field's value as a long. This method should only be used if the corresponding field has LegacySQLTypeName#INTEGER type.

Returns
TypeDescription
long

getNumericValue()

public BigDecimal getNumericValue()

Returns this field's value as a java.math.BigDecimal. This method should only be used if the corresponding field has LegacySQLTypeName#NUMERIC type.

Returns
TypeDescription
BigDecimal

getPeriodDuration()

public PeriodDuration getPeriodDuration()

Returns this field's value as a org.threeten.extra.PeriodDuration. This method should be used if the corresponding field has StandardSQLTypeName#INTERVAL type, or if it is a legal canonical format "[sign]Y-M [sign]D [sign]H:M:S[.F]", e.g. "123-7 -19 0:24:12.000006" or ISO 8601.

Returns
TypeDescription
org.threeten.extra.PeriodDuration

getRecordValue()

public FieldValueList getRecordValue()

Returns this field's value as a FieldValueList instance. This method should only be used if the corresponding field has LegacySQLTypeName#RECORD type (i.e. #getAttribute() is Attribute#RECORD).

Returns
TypeDescription
FieldValueList

getRepeatedValue()

public List<FieldValue> getRepeatedValue()

Returns this field's value as a list of FieldValue. This method should only be used if the corresponding field has Field.Mode#REPEATED mode (i.e. #getAttribute() is Attribute#REPEATED).

Returns
TypeDescription
List<FieldValue>

getStringValue()

public String getStringValue()

Returns this field's value as a String. This method should only be used if the corresponding field has primitive type (LegacySQLTypeName#BYTES, LegacySQLTypeName#BOOLEAN, LegacySQLTypeName#STRING, LegacySQLTypeName#FLOAT, LegacySQLTypeName#INTEGER, LegacySQLTypeName#NUMERIC LegacySQLTypeName#TIMESTAMP).

Returns
TypeDescription
String

getTimestampInstant()

public Instant getTimestampInstant()

Returns this field's value as a String, representing a timestamp as an Instant. This method should only be used if the corresponding field has LegacySQLTypeName#TIMESTAMP type.

Returns
TypeDescription
Instant

getTimestampValue()

public long getTimestampValue()

Returns this field's value as a long, representing a timestamp in microseconds since epoch (UNIX time). This method should only be used if the corresponding field has LegacySQLTypeName#TIMESTAMP type.

Returns
TypeDescription
long

getValue()

public Object getValue()

Returns this field's value as an Object. If #isNull() is true this method returns null.

Returns
TypeDescription
Object

hashCode()

public final int hashCode()
Returns
TypeDescription
int
Overrides

isNull()

public boolean isNull()

Returns true if this field's value is null, false otherwise.

Returns
TypeDescription
boolean

toString()

public String toString()
Returns
TypeDescription
String
Overrides