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 |
|---|---|
FieldValue.Attribute |
attribute()
Returns the attribute of this Field Value.
|
boolean |
booleanValue()
Returns this field's value as a
Boolean. |
double |
doubleValue()
Returns this field's value as a
Double. |
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
isNull()
Returns
true if this field's value is null, false otherwise. |
long |
longValue()
Returns this field's value as a
long. |
List<FieldValue> |
recordValue()
Returns this field's value as a list of
FieldValue. |
List<FieldValue> |
repeatedValue()
Returns this field's value as a list of
FieldValue. |
String |
stringValue()
Returns this field's value as a
String. |
long |
timestampValue()
Returns this field's value as a
long, representing a timestamp in microseconds since
epoch (UNIX time). |
String |
toString() |
Object |
value()
Returns this field's value as an
Object. |
public FieldValue.Attribute attribute()
FieldValue.Attribute.PRIMITIVE if the field is a primitive type
(Field.Type.bool(), Field.Type.string(),
Field.Type.floatingPoint(), Field.Type.integer(),
Field.Type.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
Field.Type.record(Field...) type.public boolean isNull()
true if this field's value is null, false otherwise.public Object value()
public String stringValue()
String. This method should only be used if the
corresponding field has primitive type (Field.Type.bool(), Field.Type.string(),
Field.Type.floatingPoint(), Field.Type.integer(),
Field.Type.timestamp()).ClassCastException - if the field is not a primitive typeNullPointerException - if isNull() returns truepublic long longValue()
long. This method should only be used if the
corresponding field has Field.Type.integer() type.ClassCastException - if the field is not a primitive typeNumberFormatException - if the field's value could not be converted to IntegerNullPointerException - if isNull() returns truepublic double doubleValue()
Double. This method should only be used if the
corresponding field has Field.Type.floatingPoint() type.ClassCastException - if the field is not a primitive typeNumberFormatException - if the field's value could not be converted to DoubleNullPointerException - if isNull() returns truepublic boolean booleanValue()
Boolean. This method should only be used if the
corresponding field has Field.Type.bool() type.ClassCastException - if the field is not a primitive typeIllegalStateException - if the field's value could not be converted to BooleanNullPointerException - if isNull() returns truepublic long timestampValue()
long, representing a timestamp in microseconds since
epoch (UNIX time). This method should only be used if the corresponding field has
Field.Type.timestamp() type.ClassCastException - if the field is not a primitive typeNumberFormatException - if the field's value could not be converted to LongNullPointerException - if isNull() returns truepublic List<FieldValue> repeatedValue()
FieldValue. This method should only be used if
the corresponding field has Field.Mode.REPEATED mode (i.e. attribute() is
FieldValue.Attribute.REPEATED).ClassCastException - if the field has not Field.Mode.REPEATED modeNullPointerException - if isNull() returns truepublic List<FieldValue> recordValue()
FieldValue. This method should only be used if
the corresponding field has Field.Type.record(Field...) type (i.e. attribute()
is FieldValue.Attribute.RECORD).ClassCastException - if the field is not a Field.Type.record(Field...) typeNullPointerException - if isNull() returns trueCopyright © 2016 Google. All rights reserved.