Class FieldValue (2.43.1)

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
Name Description
attribute FieldValue.Attribute
value Object
Returns
Type Description
FieldValue

Methods

equals(Object obj)

public final boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getAttribute()

public FieldValue.Attribute getAttribute()

Returns the attribute of this Field Value.

Returns
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
org.threeten.extra.PeriodDuration

getRangeValue()

public Range getRangeValue()

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

Returns
Type Description
Range

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
Type Description
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
Type Description
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
Type Description
String

getStringValueOrDefault(String defaultValue)

public String getStringValueOrDefault(String defaultValue)

Returns this field's value as a String, or defaultValue if #isNull() returns true. See #getStringValue() for more details.

Parameter
Name Description
defaultValue String
Returns
Type Description
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
Type Description
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
Type Description
long

getValue()

public Object getValue()

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

Returns
Type Description
Object

hashCode()

public final int hashCode()
Returns
Type Description
int
Overrides

isNull()

public boolean isNull()

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

Returns
Type Description
boolean

toString()

public String toString()
Returns
Type Description
String
Overrides