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. |
List<FieldValue> |
getRecordValue()
Returns this field's value as a list of
FieldValue. |
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
(Field.Type.bytes(), 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 getValue()
public String getStringValue()
String. This method should only be used if the
corresponding field has primitive type (Field.Type.bytes(), 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 byte[] getBytesValue()
Field.Type.bytes().ClassCastException - if the field is not a primitive typeNullPointerException - if isNull() returns trueIllegalStateException - if the field value is not encoded in base64public long getLongValue()
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 getDoubleValue()
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 getBooleanValue()
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 getTimestampValue()
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> 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 truepublic List<FieldValue> getRecordValue()
FieldValue. This method should only be used if
the corresponding field has Field.Type.record(Field...) type (i.e.
getAttribute() is FieldValue.Attribute.RECORD).ClassCastException - if the field is not a Field.Type.record(Field...) typeNullPointerException - if isNull() returns trueCopyright © 2017 Google. All rights reserved.