public interface FieldValue extends Comparable<FieldValue>
FieldValue is the building block of row values in a table.
The FieldValue interface defines casting and interrogation methods common to
all implementing classes. Each implementing type has its own interface
which is an extension of FieldValue. In most cases interfaces that extend
FieldValue have corresponding classes that extend FieldDef
. The
exceptions are Row
, PrimaryKey
and IndexKey
. These
all extend RecordValue
as they are specialized instances of records.
By default fields can be nullable, which means that a special null value can
be assigned to them. A null value is a FieldValue instance that returns true
for isNull()
and will throw exceptions for most other operations that
require an actual instance of a type. This means that callers who might
reasonably expect a null value should first check to see if the value is null
before using the value.
FieldValue instances are not thread safe.
Modifier and Type | Method and Description |
---|---|
ArrayValue |
asArray()
Casts to ArrayValue.
|
BinaryValue |
asBinary()
Casts to BinaryValue.
|
BooleanValue |
asBoolean()
Casts to BooleanValue.
|
DoubleValue |
asDouble()
Casts to DoubleValue.
|
EnumValue |
asEnum()
Casts to EnumValue.
|
FixedBinaryValue |
asFixedBinary()
Casts to FixedBinaryValue.
|
FloatValue |
asFloat()
Casts to FloatValue.
|
IndexKey |
asIndexKey()
Casts to IndexKey.
|
IntegerValue |
asInteger()
Casts to IntegerValue.
|
LongValue |
asLong()
Casts to LongValue.
|
MapValue |
asMap()
Casts to MapValue.
|
NumberValue |
asNumber()
Casts to NumberValue.
|
PrimaryKey |
asPrimaryKey()
Casts to PrimaryKey.
|
RecordValue |
asRecord()
Casts to RecordValue.
|
Row |
asRow()
Casts to Row.
|
StringValue |
asString()
Casts to StringValue.
|
TimestampValue |
asTimestamp()
Casts to TimestampValue.
|
FieldValue |
clone()
Create a deep copy of this object.
|
FieldDef |
getDefinition()
Returns the type associated with this value.
|
FieldDef.Type |
getType()
Returns the kind of the type associated with this value.
|
boolean |
isArray()
Returns true if this is an
ArrayValue . |
boolean |
isAtomic()
Returns true if this is an atomic value.
|
boolean |
isBinary()
Returns true if this is a
BinaryValue . |
boolean |
isBoolean()
Returns true if this is a
BooleanValue . |
boolean |
isComplex()
Returns true if this is a complex value.
|
boolean |
isDouble()
Returns true if this is a
DoubleValue . |
boolean |
isEMPTY()
Returns true if this is an EMPTY value instance.
|
boolean |
isEnum()
Returns true if this is an
EnumValue . |
boolean |
isFixedBinary()
Returns true if this is a
FixedBinaryValue . |
boolean |
isFloat()
Returns true if this is a
FloatValue . |
boolean |
isIndexKey()
Returns true if this is an
IndexKey . |
boolean |
isInteger()
Returns true if this is an
IntegerValue . |
boolean |
isJsonNull()
Returns true if this is a null value in a JSON field.
|
boolean |
isLong()
Returns true if this is a
LongValue . |
boolean |
isMap()
Returns true if this is a
MapValue . |
boolean |
isNull()
Returns true if this is a null value instance.
|
boolean |
isNumber()
Returns true if this is a
NumberValue . |
boolean |
isNumeric()
Returns true if this is numeric value.
|
boolean |
isPrimaryKey()
Returns true if this is a
PrimaryKey . |
boolean |
isRecord()
Returns true if this is a
RecordValue . |
boolean |
isRow()
Returns true if this is a
Row . |
boolean |
isString()
Returns true if this is a
StringValue . |
boolean |
isTimestamp()
Returns true if this is a
TimestampValue . |
String |
toJsonString(boolean prettyPrint)
Create a JSON representation of the value.
|
compareTo
FieldValue clone()
FieldDef.Type getType()
UnsupportedOperationException
- if this is the NullValueFieldDef getDefinition()
UnsupportedOperationException
- if this is the NullValueboolean isBoolean()
BooleanValue
.boolean isBinary()
BinaryValue
.boolean isDouble()
DoubleValue
.boolean isEnum()
EnumValue
.boolean isFixedBinary()
FixedBinaryValue
.boolean isFloat()
FloatValue
.boolean isInteger()
IntegerValue
.boolean isLong()
LongValue
.boolean isNumber()
NumberValue
.boolean isString()
StringValue
.boolean isTimestamp()
TimestampValue
.boolean isArray()
ArrayValue
.boolean isMap()
MapValue
.boolean isRecord()
RecordValue
.boolean isRow()
Row
. Row also
returns true for isRecord()
.boolean isPrimaryKey()
boolean isIndexKey()
IndexKey
. IndexKey also
returns true for isRecord()
.boolean isJsonNull()
isNull()
.boolean isNull()
boolean isEMPTY()
An EMPTY value is used internally to represent cases where an expression
returns an empty result. Applications do not normally have to deal with
EMPTY values. The only exception is in IndexKey instances: when a
TableIterator is used to scan an index and return index keys, the EMPTY
value may appear in the returned IndexKey instances. This method can be
used to check if the value of an IndexKey field is EMPTY. Applications
may also use the IndexKey.putEMPTY(int)
or
IndexKey.putEMPTY(String)
method to search an index for
entries containing the EMPTY value in one or more of their fields.
boolean isAtomic()
boolean isNumeric()
boolean isComplex()
BinaryValue asBinary()
ClassCastException
- if this is not a BinaryValueNumberValue asNumber()
ClassCastException
- if this is not a NumberValueBooleanValue asBoolean()
ClassCastException
- if this is not a BooleanValueDoubleValue asDouble()
ClassCastException
- if this is not a DoubleValueEnumValue asEnum()
ClassCastException
- if this is not an EnumValueFixedBinaryValue asFixedBinary()
ClassCastException
- if this is not a FixedBinaryValueFloatValue asFloat()
ClassCastException
- if this is not a FloatValueIntegerValue asInteger()
ClassCastException
- if this is not an IntegerValueLongValue asLong()
ClassCastException
- if this is not a LongValueStringValue asString()
ClassCastException
- if this is not a StringValueTimestampValue asTimestamp()
ClassCastException
- if this is not a TimestampValueArrayValue asArray()
ClassCastException
- if this is not an ArrayValueMapValue asMap()
ClassCastException
- if this is not a MapValueRecordValue asRecord()
ClassCastException
- if this is not a RecordValueRow asRow()
ClassCastException
- if this is not a Row.PrimaryKey asPrimaryKey()
ClassCastException
- if this is not a PrimaryKeyIndexKey asIndexKey()
ClassCastException
- if this is not an IndexKeyString toJsonString(boolean prettyPrint)
prettyPrint
- set to true for a nicely formatted JSON string,
with indentation and carriage returns, otherwise the string will be a
single lineCopyright (c) 2011, 2017 Oracle and/or its affiliates. All rights reserved.