@Immutable public interface Document extends Serializable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Document.ListBuilder |
static interface |
Document.MapBuilder |
| Modifier and Type | Method and Description |
|---|---|
<R> R |
accept(DocumentVisitor<? extends R> visitor)
Accepts a visitor to the Document.
|
void |
accept(VoidDocumentVisitor visitor)
Accepts a visitor with the Document.
|
boolean |
asBoolean()
Gets the document as a
boolean if it is a boolean. |
List<Document> |
asList()
Gets the document as a
List if it is a document type array. |
Map<String,Document> |
asMap()
Gets the document as a
Map. |
SdkNumber |
asNumber()
|
String |
asString()
Gets the document as a
String. |
static Document |
fromBoolean(boolean booleanValue)
Create
Document from a boolean. |
static Document |
fromList(List<Document> documentList)
Create a
Document.ListBuilder for generating a Document by directly allowing user add Documents. |
static Document |
fromMap(Map<String,Document> documentMap)
Creates a Document from a Map of Documents.
|
static Document |
fromNull()
Creates a document is a
null value. |
static Document |
fromNumber(BigDecimal number)
Create
Document from a BigDecimal. |
static Document |
fromNumber(BigInteger number)
Create
Document from a BigInteger. |
static Document |
fromNumber(double number)
Create
Document from a double. |
static Document |
fromNumber(float number)
Create
Document from a float. |
static Document |
fromNumber(int number)
Create
Document from a int. |
static Document |
fromNumber(long number)
Create
Document from a long. |
static Document |
fromNumber(SdkNumber number)
|
static Document |
fromNumber(String number)
Create
Document from a String. |
static Document |
fromString(String string)
Create
Document from a string, using the provided String. |
default boolean |
isBoolean() |
default boolean |
isList() |
default boolean |
isMap() |
default boolean |
isNull()
Checks if the document is a
null value. |
default boolean |
isNumber() |
default boolean |
isString() |
static Document.ListBuilder |
listBuilder()
Provides Builder methods of
Document.ListBuilder to directly create Document with List of Documents |
static Document.MapBuilder |
mapBuilder()
Create a
Document.MapBuilder for generating a Document by directly allowing user to put String Keys
and Document Values in the builder methods. |
Object |
unwrap()
Gets the value of the document as a Java type that represents the
document type data model:
boolean, String for Strings and Numbers,
null, List<Object>, or
Map<String, Object>. |
static Document fromString(String string)
Document from a string, using the provided String.string - String value.static Document fromBoolean(boolean booleanValue)
Document from a boolean.booleanValue - Boolean value.static Document fromNumber(int number)
Document from a int.number - int type number.SdkNumber constructed SdkNumber.fromInteger(int).static Document fromNumber(long number)
Document from a long.number - long type number.SdkNumber constructed SdkNumber.longValue().static Document fromNumber(float number)
Document from a float.number - float type number.SdkNumber constructed SdkNumber.floatValue()static Document fromNumber(double number)
Document from a double.number - double type number.SdkNumber constructed SdkNumber.fromDouble(double)static Document fromNumber(BigDecimal number)
Document from a BigDecimal.number - BigDecimal type number.SdkNumber constructed SdkNumber.fromBigDecimal(BigDecimal)static Document fromNumber(BigInteger number)
Document from a BigInteger.number - BigInteger type number.SdkNumber constructed SdkNumber.fromBigInteger(BigInteger)static Document fromNumber(String number)
Document from a String.number - String representation of a number.SdkNumber constructed SdkNumber.fromString(String)ParseException - Throws ParseException when the inputString is not of Number format.static Document fromMap(Map<String,Document> documentMap)
documentMap - Map with Keys of Type Strinb and Value of Document type.static Document fromList(List<Document> documentList)
Document.ListBuilder for generating a Document by directly allowing user add Documents.documentList - List of Documents.static Document.MapBuilder mapBuilder()
Document.MapBuilder for generating a Document by directly allowing user to put String Keys
and Document Values in the builder methods.static Document.ListBuilder listBuilder()
Document.ListBuilder to directly create Document with List of Documentsstatic Document fromNull()
null value.Object unwrap()
boolean, String for Strings and Numbers,
null, List<Object>, or
Map<String, Object>.default boolean isNull()
null value.null value.default boolean isBoolean()
boolean asBoolean()
boolean if it is a boolean.UnsupportedOperationException - if the document is not a boolean.default boolean isString()
String asString()
String.UnsupportedOperationException - if the document is not a string.default boolean isNumber()
SdkNumber asNumber()
SdkNumber.UnsupportedOperationException - if the document is not a number.default boolean isMap()
Map<String,Document> asMap()
Map.
Each value contained in the Map is the same as how the value
would be represented by Document.
UnsupportedOperationException - if the document is not an Map.default boolean isList()
List<Document> asList()
List if it is a document type array.
Each value contained in the List is the same as how the
value would be represented by Document.
UnsupportedOperationException - if the document is not an List.<R> R accept(DocumentVisitor<? extends R> visitor)
R - visitor return type.visitor - Visitor to dispatch to.void accept(VoidDocumentVisitor visitor)
visitor - Visitor to dispatch to.Copyright © 2021. All rights reserved.