@API.Public public class Documents extends Object
Document
interface.Constructor and Description |
---|
Documents() |
Modifier and Type | Method and Description |
---|---|
static boolean |
equals(Document d1,
Document d2)
Compares two documents for equality.
|
static ByteBuffer |
getBinary(Document document,
FieldPath fieldPath,
ByteBuffer defaultValue)
Returns the value at the specified fieldPath as a
ByteBuffer object or
the specified defaultValue if the specified FieldPath does not
exist in the document. |
static ByteBuffer |
getBinary(Document document,
String fieldPath,
ByteBuffer defaultValue)
Returns the value at the specified fieldPath as a
ByteBuffer object or
the specified defaultValue if the specified FieldPath does not
exist in the document. |
static boolean |
getBoolean(Document document,
FieldPath fieldPath,
boolean defaultValue)
Returns the value at the specified fieldPath as a
boolean or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static boolean |
getBoolean(Document document,
String fieldPath,
boolean defaultValue)
Returns the value at the specified fieldPath as a
boolean or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static byte |
getByte(Document document,
FieldPath fieldPath,
byte defaultValue)
Returns the value at the specified fieldPath as a
byte or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static byte |
getByte(Document document,
String fieldPath,
byte defaultValue)
Returns the value at the specified fieldPath as a
byte or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static ODate |
getDate(Document document,
FieldPath fieldPath,
ODate defaultValue)
Returns the value at the specified fieldPath as a
ODate or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static ODate |
getDate(Document document,
String fieldPath,
ODate defaultValue)
Returns the value at the specified fieldPath as a
ODate or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static BigDecimal |
getDecimal(Document document,
FieldPath fieldPath,
BigDecimal defaultValue)
Returns the value at the specified fieldPath as a
BigDecimal or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static BigDecimal |
getDecimal(Document document,
String fieldPath,
BigDecimal defaultValue)
Returns the value at the specified fieldPath as a
BigDecimal or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static double |
getDouble(Document document,
FieldPath fieldPath,
double defaultValue)
Returns the value at the specified fieldPath as a
double or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static double |
getDouble(Document document,
String fieldPath,
double defaultValue)
Returns the value at the specified fieldPath as a
double or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static float |
getFloat(Document document,
FieldPath fieldPath,
float defaultValue)
Returns the value at the specified fieldPath as a
float or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static float |
getFloat(Document document,
String fieldPath,
float defaultValue)
Returns the value at the specified fieldPath as a
float or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static int |
getInt(Document document,
FieldPath fieldPath,
int defaultValue)
Returns the value at the specified fieldPath as a
int or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static int |
getInt(Document document,
String fieldPath,
int defaultValue)
Returns the value at the specified fieldPath as a
int or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static OInterval |
getInterval(Document document,
FieldPath fieldPath,
OInterval defaultValue)
Returns the value at the specified fieldPath as a
OInterval or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static OInterval |
getInterval(Document document,
String fieldPath,
OInterval defaultValue)
Returns the value at the specified fieldPath as a
OInterval or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static List<Object> |
getList(Document document,
FieldPath fieldPath,
List<Object> defaultValue)
Returns the value at the specified fieldPath as a
List or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static List<Object> |
getList(Document document,
String fieldPath,
List<Object> defaultValue)
Returns the value at the specified fieldPath as a
List or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static long |
getLong(Document document,
FieldPath fieldPath,
long defaultValue)
Returns the value at the specified fieldPath as a
long or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static long |
getLong(Document document,
String fieldPath,
long defaultValue)
Returns the value at the specified fieldPath as a
long or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static Map<String,Object> |
getMap(Document document,
FieldPath fieldPath,
Map<String,Object> defaultValue)
Returns the value at the specified fieldPath as a
Map or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static Map<String,Object> |
getMap(Document document,
String fieldPath,
Map<String,Object> defaultValue)
Returns the value at the specified fieldPath as a
Map or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static short |
getShort(Document document,
FieldPath fieldPath,
short defaultValue)
Returns the value at the specified fieldPath as a
short or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static short |
getShort(Document document,
String fieldPath,
short defaultValue)
Returns the value at the specified fieldPath as a
short or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static String |
getString(Document document,
FieldPath fieldPath,
String defaultValue)
Returns the value at the specified fieldPath as a
String or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static String |
getString(Document document,
String fieldPath,
String defaultValue)
Returns the value at the specified fieldPath as a
String or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static OTime |
getTime(Document document,
FieldPath fieldPath,
OTime defaultValue)
Returns the value at the specified fieldPath as a
OTime or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static OTime |
getTime(Document document,
String fieldPath,
OTime defaultValue)
Returns the value at the specified fieldPath as a
OTime or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static OTimestamp |
getTimestamp(Document document,
FieldPath fieldPath,
OTimestamp defaultValue)
Returns the value at the specified fieldPath as a
OTimestamp or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static OTimestamp |
getTimestamp(Document document,
String fieldPath,
OTimestamp defaultValue)
Returns the value at the specified fieldPath as a
OTimestamp or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static Value |
getValue(Document document,
FieldPath fieldPath,
Value defaultValue)
Returns the value at the specified fieldPath as a
Value or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static Value |
getValue(Document document,
String fieldPath,
Value defaultValue)
Returns the value at the specified fieldPath as a
Value or the
specified defaultValue if the specified FieldPath does not
exist in the document. |
static Document |
readOnly(Document src)
Creates and return a read-only view of the specified OJAI document.
Any attempt to modify the returned document will result in
ReadOnlyObjectException being thrown. |
static void |
writeReaderToBuilder(DocumentReader reader,
DocumentBuilder builder)
|
public static boolean equals(@API.Nullable Document d1, @API.Nullable Document d2)
d1
- the first document to compared2
- the second document to comparetrue
if both the documents are equal,
false
otherwise.public static Document readOnly(Document src)
ReadOnlyObjectException
being thrown.src
- the source Document
public static void writeReaderToBuilder(@API.NonNullable DocumentReader reader, @API.NonNullable DocumentBuilder builder)
reader
- instance of DocumentReader to read the fields frombuilder
- instance of DocumentBuilder to write the field topublic static ByteBuffer getBinary(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, @API.Nullable ByteBuffer defaultValue)
ByteBuffer
object or
the specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
BINARY
typepublic static ByteBuffer getBinary(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable ByteBuffer defaultValue)
ByteBuffer
object or
the specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
BINARY
typepublic static boolean getBoolean(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, @API.Nullable boolean defaultValue)
boolean
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
BOOLEAN
typepublic static boolean getBoolean(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable boolean defaultValue)
boolean
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
BOOLEAN
typepublic static byte getByte(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, @API.Nullable byte defaultValue)
byte
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static byte getByte(@API.NonNullable Document document, @API.NonNullable String fieldPath, byte defaultValue)
byte
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static ODate getDate(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, @API.Nullable ODate defaultValue)
ODate
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the DATE
typepublic static ODate getDate(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable ODate defaultValue)
ODate
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the DATE
typepublic static BigDecimal getDecimal(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, @API.Nullable BigDecimal defaultValue)
BigDecimal
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static BigDecimal getDecimal(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable BigDecimal defaultValue)
BigDecimal
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static double getDouble(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, double defaultValue)
double
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static double getDouble(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable double defaultValue)
double
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static float getFloat(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, float defaultValue)
float
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static float getFloat(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable float defaultValue)
float
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static int getInt(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, int defaultValue)
int
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static int getInt(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable int defaultValue)
int
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static OInterval getInterval(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, @API.Nullable OInterval defaultValue)
OInterval
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the INTERVAL
typepublic static OInterval getInterval(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable OInterval defaultValue)
OInterval
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the INTERVAL
typepublic static List<Object> getList(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, @API.Nullable List<Object> defaultValue)
List
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the ARRAY
typepublic static List<Object> getList(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable List<Object> defaultValue)
List
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the ARRAY
typepublic static long getLong(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, long defaultValue)
long
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static long getLong(@API.NonNullable Document document, @API.NonNullable String fieldPath, long defaultValue)
long
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static Map<String,Object> getMap(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, @API.Nullable Map<String,Object> defaultValue)
Map
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the MAP
typepublic static Map<String,Object> getMap(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable Map<String,Object> defaultValue)
Map
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the MAP
typepublic static short getShort(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, short defaultValue)
short
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static short getShort(@API.NonNullable Document document, @API.NonNullable String fieldPath, short defaultValue)
short
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not one of
the numeric typespublic static String getString(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, @API.Nullable String defaultValue)
String
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the STRING
typepublic static String getString(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable String defaultValue)
String
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the STRING
typepublic static OTime getTime(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, @API.Nullable OTime defaultValue)
OTime
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the TIME
typepublic static OTime getTime(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable OTime defaultValue)
OTime
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the TIME
typepublic static OTimestamp getTimestamp(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, @API.Nullable OTimestamp defaultValue)
OTimestamp
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the TIMESTAMP
typepublic static OTimestamp getTimestamp(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable OTimestamp defaultValue)
OTimestamp
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.TypeException
- if the value at the fieldPath is not of
the TIMESTAMP
typepublic static Value getValue(@API.NonNullable Document document, @API.NonNullable FieldPath fieldPath, @API.Nullable Value defaultValue)
Value
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.public static Value getValue(@API.NonNullable Document document, @API.NonNullable String fieldPath, @API.Nullable Value defaultValue)
Value
or the
specified defaultValue
if the specified FieldPath
does not
exist in the document.Copyright © 2015–2019 MapR Technologies, Inc.. All rights reserved.