Interface Document
- All Superinterfaces:
- Serializable
- All Known Implementing Classes:
- BooleanDocument,- ListDocument,- MapDocument,- NullDocument,- NumberDocument,- StringDocument
Interface for Document Types.
 Document types are used to carry open content that is Data with no fixed schema, data that can't be modeled using rigid types,
 or data that has a schema that evolves outside the purview of a service
 without requiring techniques like embedding JSON inside JSON strings.
 Document type value is serialized using the same format as its surroundings and requires no additional encoding or escaping.
 This interface specifies all the methods to access a Document, also provides constructor methods for
 instantiating Document.
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interface
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final BooleanDocumentstatic final NullDocumentNull document constant.static final BooleanDocumentBoolean document constants.
- 
Method SummaryModifier and TypeMethodDescription<R> Raccept(DocumentVisitor<? extends R> visitor) Accepts a visitor to the Document.voidaccept(VoidDocumentVisitor visitor) Accepts a visitor with the Document.booleanGets the document as abooleanif it is a boolean.asList()Gets the document as aListif it is a document type array.asMap()Gets the document as aMap.asNumber()asString()Gets the document as aString.static DocumentfromBoolean(boolean booleanValue) CreateDocumentfrom a boolean.static DocumentCreate aDocument.ListBuilderfor generating aDocumentby directly allowing user add Documents.static DocumentCreates a Document from a Map of Documents.static DocumentfromNull()Creates a document is anullvalue.static DocumentfromNumber(double number) CreateDocumentfrom a double.static DocumentfromNumber(float number) CreateDocumentfrom a float.static DocumentfromNumber(int number) CreateDocumentfrom a int.static DocumentfromNumber(long number) CreateDocumentfrom a long.static DocumentfromNumber(String number) CreateDocumentfrom a String.static DocumentfromNumber(BigDecimal number) CreateDocumentfrom a BigDecimal.static DocumentfromNumber(BigInteger number) CreateDocumentfrom a BigInteger.static DocumentfromNumber(SdkNumber number) static DocumentfromString(String string) CreateDocumentfrom a string, using the provided String.default booleandefault booleanisList()default booleanisMap()default booleanisNull()Checks if the document is anullvalue.default booleanisNumber()default booleanisString()static Document.ListBuilderProvides Builder methods ofDocument.ListBuilderto directly create Document with List of Documentsstatic Document.MapBuilderCreate aDocument.MapBuilderfor generating aDocumentby directly allowing user to put String Keys and Document Values in the builder methods.unwrap()Gets the value of the document as a Java type that represents the document type data model:boolean,Stringfor Strings and Numbers,null,List<Object>, orMap<String, Object>.
- 
Field Details- 
NULL_DOCUMENTNull document constant. Null values are invariant, no need to create a new one everytime we find a null value, instead we use this static constant.
- 
TRUE_DOCUMENTBoolean document constants. Boolean values are invariant, no need to create a new one everytime we find a boolean value, instead we use either constant.
- 
FALSE_DOCUMENT
 
- 
- 
Method Details- 
fromString
- 
fromBoolean
- 
fromNumber
- 
fromNumberCreateDocumentfrom a int.- Parameters:
- number- int type number.
- Returns:
- Implementation of Document that stores a SdkNumberconstructedSdkNumber.fromInteger(int).
 
- 
fromNumberCreateDocumentfrom a long.- Parameters:
- number- long type number.
- Returns:
- Implementation of Document that stores a SdkNumberconstructedSdkNumber.longValue().
 
- 
fromNumberCreateDocumentfrom a float.- Parameters:
- number- float type number.
- Returns:
- Implementation of Document that stores a SdkNumberconstructedSdkNumber.floatValue()
 
- 
fromNumberCreateDocumentfrom a double.- Parameters:
- number- double type number.
- Returns:
- Implementation of Document that stores a SdkNumberconstructedSdkNumber.fromDouble(double)
 
- 
fromNumberCreateDocumentfrom a BigDecimal.- Parameters:
- number- BigDecimal type number.
- Returns:
- Implementation of Document that stores a SdkNumberconstructedSdkNumber.fromBigDecimal(BigDecimal)
 
- 
fromNumberCreateDocumentfrom a BigInteger.- Parameters:
- number- BigInteger type number.
- Returns:
- Implementation of Document that stores a SdkNumberconstructedSdkNumber.fromBigInteger(BigInteger)
 
- 
fromNumberCreateDocumentfrom a String.- Parameters:
- number- String representation of a number.
- Returns:
- Implementation of Document that stores a SdkNumberconstructedSdkNumber.fromString(String)
- Throws:
- ParseException- Throws ParseException when the inputString is not of Number format.
 
- 
fromMap
- 
fromListCreate aDocument.ListBuilderfor generating aDocumentby directly allowing user add Documents.- Parameters:
- documentList- List of Documents.
- Returns:
- Implementation of Document that stores a Lists of Documents.
 
- 
mapBuilderCreate aDocument.MapBuilderfor generating aDocumentby directly allowing user to put String Keys and Document Values in the builder methods.- Returns:
- Builder to Construct Document with Map of Documents.
 
- 
listBuilderProvides Builder methods ofDocument.ListBuilderto directly create Document with List of Documents- Returns:
- Builder methods to Construct Document with List of Documents.
 
- 
fromNullCreates a document is anullvalue.- Returns:
- Implementation of a Null Document.
 
- 
unwrapObject unwrap()Gets the value of the document as a Java type that represents the document type data model:boolean,Stringfor Strings and Numbers,null,List<Object>, orMap<String, Object>.- Returns:
- Returns the document as one of a fixed set of Java types.
 
- 
isNulldefault boolean isNull()Checks if the document is anullvalue.- Returns:
- Returns true if the document is a nullvalue.
 
- 
isBooleandefault boolean isBoolean()- Returns:
- Returns true if this document is a boolean value.
 
- 
asBooleanboolean asBoolean()Gets the document as abooleanif it is a boolean.- Returns:
- Returns the boolean value.
- Throws:
- UnsupportedOperationException- if the document is not a boolean.
 
- 
isStringdefault boolean isString()- Returns:
- Returns true if this document is a string value.
 
- 
asStringString asString()Gets the document as aString.- Returns:
- Returns the string value.
- Throws:
- UnsupportedOperationException- if the document is not a string.
 
- 
isNumberdefault boolean isNumber()- Returns:
- Returns true if this document is a number value.
 
- 
asNumberSdkNumber asNumber()- Returns:
- Returns the SdkNumber.
- Throws:
- UnsupportedOperationException- if the document is not a number.
 
- 
isMapdefault boolean isMap()- Returns:
- Returns true if this document is a Map.
 
- 
asMapGets the document as aMap.Each value contained in the Mapis the same as how the value would be represented byDocument.- Returns:
- Returns the Document map.
- Throws:
- UnsupportedOperationException- if the document is not an Map.
 
- 
isListdefault boolean isList()- Returns:
- Returns true if this document is a document type List.
 
- 
asListGets the document as aListif it is a document type array.Each value contained in the Listis the same as how the value would be represented byDocument.- Returns:
- Returns the lists of Document.
- Throws:
- UnsupportedOperationException- if the document is not an List.
 
- 
acceptAccepts a visitor to the Document.- Type Parameters:
- R- visitor return type.
- Parameters:
- visitor- Visitor to dispatch to.
- Returns:
- Returns the accepted result.
 
- 
acceptAccepts a visitor with the Document.- Parameters:
- visitor- Visitor to dispatch to.
 
 
-