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.
Implements
SerializableStatic 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.
Name | Description |
attribute | FieldValue.Attribute |
value | Object |
Type | Description |
FieldValue |
Methods
equals(Object obj)
public final boolean equals(Object obj)
Name | Description |
obj | Object |
Type | Description |
boolean |
getAttribute()
public FieldValue.Attribute getAttribute()
Returns the attribute of this Field Value.
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 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.
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.
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.
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.
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.
Type | Description |
BigDecimal |
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).
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).
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).
Type | Description |
String |
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.
Type | Description |
long |
getValue()
public Object getValue()
Type | Description |
Object |
hashCode()
public final int hashCode()
Type | Description |
int |
isNull()
public boolean isNull()
Returns true
if this field's value is null
, false
otherwise.
Type | Description |
boolean |
toString()
public String toString()
Type | Description |
String |