public class FieldValue extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
FieldValue.Attribute
The field value's attribute, giving information on the field's content type.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
FieldValue.Attribute |
getAttribute()
Returns the attribute of this Field Value.
|
boolean |
getBooleanValue()
Returns this field's value as a
Boolean . |
byte[] |
getBytesValue()
Returns this field's value as a byte array.
|
double |
getDoubleValue()
Returns this field's value as a
Double . |
long |
getLongValue()
Returns this field's value as a
long . |
FieldValueList |
getRecordValue()
Returns this field's value as a
FieldValueList instance. |
List<FieldValue> |
getRepeatedValue()
Returns this field's value as a list of
FieldValue . |
String |
getStringValue()
Returns this field's value as a
String . |
long |
getTimestampValue()
Returns this field's value as a
long , representing a timestamp in microseconds since
epoch (UNIX time). |
Object |
getValue()
Returns this field's value as an
Object . |
int |
hashCode() |
boolean |
isNull()
Returns
true if this field's value is null , false otherwise. |
String |
toString() |
public FieldValue.Attribute getAttribute()
FieldValue.Attribute.PRIMITIVE
if the field is a primitive type
(LegacySQLTypeName.BYTES
, LegacySQLTypeName.BOOLEAN
, LegacySQLTypeName.STRING
,
LegacySQLTypeName.FLOAT
, LegacySQLTypeName.INTEGER
,
LegacySQLTypeName.TIMESTAMP
) or is null
. Returns FieldValue.Attribute.REPEATED
if
the corresponding field has (Field.Mode.REPEATED
) mode. Returns
FieldValue.Attribute.RECORD
if the corresponding field is a
LegacySQLTypeName.RECORD
type.public boolean isNull()
true
if this field's value is null
, false
otherwise.public Object getValue()
public String getStringValue()
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.TIMESTAMP
).ClassCastException
- if the field is not a primitive typeNullPointerException
- if isNull()
returns true
public byte[] getBytesValue()
LegacySQLTypeName.BYTES
.ClassCastException
- if the field is not a primitive typeNullPointerException
- if isNull()
returns true
IllegalStateException
- if the field value is not encoded in base64public long getLongValue()
long
. This method should only be used if the
corresponding field has LegacySQLTypeName.INTEGER
type.ClassCastException
- if the field is not a primitive typeNumberFormatException
- if the field's value could not be converted to Integer
NullPointerException
- if isNull()
returns true
public double getDoubleValue()
Double
. This method should only be used if the
corresponding field has LegacySQLTypeName.FLOAT
type.ClassCastException
- if the field is not a primitive typeNumberFormatException
- if the field's value could not be converted to Double
NullPointerException
- if isNull()
returns true
public boolean getBooleanValue()
Boolean
. This method should only be used if the
corresponding field has LegacySQLTypeName.BOOLEAN
type.ClassCastException
- if the field is not a primitive typeIllegalStateException
- if the field's value could not be converted to Boolean
NullPointerException
- if isNull()
returns true
public long getTimestampValue()
long
, representing a timestamp in microseconds since
epoch (UNIX time). This method should only be used if the corresponding field has
LegacySQLTypeName.TIMESTAMP
type.ClassCastException
- if the field is not a primitive typeNumberFormatException
- if the field's value could not be converted to Long
NullPointerException
- if isNull()
returns true
public List<FieldValue> getRepeatedValue()
FieldValue
. This method should only be used if
the corresponding field has Field.Mode.REPEATED
mode (i.e. getAttribute()
is
FieldValue.Attribute.REPEATED
).ClassCastException
- if the field has not Field.Mode.REPEATED
modeNullPointerException
- if isNull()
returns true
public FieldValueList getRecordValue()
FieldValueList
instance. This method should only be used if
the corresponding field has LegacySQLTypeName.RECORD
type (i.e.
getAttribute()
is FieldValue.Attribute.RECORD
).ClassCastException
- if the field is not a LegacySQLTypeName.RECORD
typeNullPointerException
- if isNull()
returns true
Copyright © 2017 Google. All rights reserved.