public final class MutableDocument extends Document implements MutableDictionaryInterface
Constructor and Description |
---|
MutableDocument()
Creates a new Document object with a new random UUID.
|
MutableDocument(Map<String,Object> data)
Creates a new Document with a new random UUID and the map as the content.
|
MutableDocument(String id)
Creates a new Document with the given ID.
|
MutableDocument(String id,
Map<String,Object> data)
Creates a new Document with a given ID and content from the passed Map.
|
MutableDocument(String id,
String json)
Creates a new Document with the given ID and content from the passed JSON string.
|
Modifier and Type | Method and Description |
---|---|
MutableArray |
getArray(String key)
Get a property's value as a Array, which is a mapping object of an array value.
|
MutableDictionary |
getDictionary(String key)
Get a property's value as a Dictionary, which is a mapping object of an dictionary value.
|
MutableDocument |
remove(String key)
Removes the mapping for a key from this Dictionary
|
MutableDocument |
setArray(String key,
Array value)
Set an Array value for the given key
|
MutableDocument |
setBlob(String key,
Blob value)
Set a Blob value for the given key
|
MutableDocument |
setBoolean(String key,
boolean value)
Set a boolean value for the given key
|
MutableDocument |
setData(Map<String,Object> data)
Populate a document with content from a Map.
|
MutableDocument |
setDate(String key,
Date value)
Set a Date value for the given key
|
MutableDocument |
setDictionary(String key,
Dictionary value)
Set a Dictionary value for the given key
|
MutableDocument |
setDouble(String key,
double value)
Set a double value for the given key
|
MutableDocument |
setFloat(String key,
float value)
Set a float value for the given key
|
MutableDocument |
setInt(String key,
int value)
Set a integer value for the given key
|
MutableDocument |
setJSON(String json)
Populate a document with content from a JSON string.
|
MutableDocument |
setLong(String key,
long value)
Set a long value for the given key
|
MutableDocument |
setNumber(String key,
Number value)
Set a Number value for the given key
|
MutableDocument |
setString(String key,
String value)
Set a String value for the given key
|
MutableDocument |
setValue(String key,
Object value)
Set an object value by key.
|
String |
toJSON() |
MutableDocument |
toMutable()
Returns the copy of this MutableDocument object.
|
contains, count, equals, getBlob, getBoolean, getDate, getDouble, getFloat, getId, getInt, getKeys, getLong, getNumber, getRevisionID, getSequence, getString, getValue, hashCode, iterator, toMap, toString
contains, count, getBlob, getBoolean, getDate, getDouble, getFloat, getInt, getKeys, getLong, getNumber, getString, getValue, toMap
forEach, spliterator
public MutableDocument()
public MutableDocument(@Nullable String id)
id
- the document ID or null.public MutableDocument(@NonNull Map<String,Object> data)
data
- the Map objectpublic MutableDocument(@Nullable String id, @NonNull Map<String,Object> data)
id
- the document ID.data
- the Map objectpublic MutableDocument(@Nullable String id, @NonNull String json)
id
- the document ID or null.json
- the document content as a JSON string.@NonNull public MutableDocument toMutable()
@NonNull public MutableDocument setData(@NonNull Map<String,Object> data)
setData
in interface MutableDictionaryInterface
data
- the dictionary object.@NonNull public MutableDocument setJSON(@NonNull String json)
setJSON
in interface MutableDictionaryInterface
json
- the dictionary object.@NonNull public MutableDocument setValue(@NonNull String key, @Nullable Object value)
setValue
in interface MutableDictionaryInterface
key
- the key.value
- the Object value.@NonNull public MutableDocument setString(@NonNull String key, @Nullable String value)
setString
in interface MutableDictionaryInterface
key
- the key.value
- the String value.@NonNull public MutableDocument setNumber(@NonNull String key, @Nullable Number value)
setNumber
in interface MutableDictionaryInterface
key
- the key.value
- the Number value.@NonNull public MutableDocument setInt(@NonNull String key, int value)
setInt
in interface MutableDictionaryInterface
key
- the key.value
- the integer value.@NonNull public MutableDocument setLong(@NonNull String key, long value)
setLong
in interface MutableDictionaryInterface
key
- the key.value
- the long value.@NonNull public MutableDocument setFloat(@NonNull String key, float value)
setFloat
in interface MutableDictionaryInterface
key
- the key.value
- the float value.@NonNull public MutableDocument setDouble(@NonNull String key, double value)
setDouble
in interface MutableDictionaryInterface
key
- the key.value
- the double value.@NonNull public MutableDocument setBoolean(@NonNull String key, boolean value)
setBoolean
in interface MutableDictionaryInterface
key
- the key.value
- the boolean value.@NonNull public MutableDocument setBlob(@NonNull String key, @Nullable Blob value)
setBlob
in interface MutableDictionaryInterface
key
- the key.value
- the Blob value.@NonNull public MutableDocument setDate(@NonNull String key, @Nullable Date value)
setDate
in interface MutableDictionaryInterface
key
- the key.value
- the Date value.@NonNull public MutableDocument setArray(@NonNull String key, @Nullable Array value)
setArray
in interface MutableDictionaryInterface
key
- the key.value
- the Array value.@NonNull public MutableDocument setDictionary(@NonNull String key, @Nullable Dictionary value)
setDictionary
in interface MutableDictionaryInterface
key
- the key.value
- the Dictionary value.@NonNull public MutableDocument remove(@NonNull String key)
remove
in interface MutableDictionaryInterface
key
- the key.@Nullable public MutableArray getArray(@NonNull String key)
getArray
in interface DictionaryInterface
getArray
in interface MutableDictionaryInterface
getArray
in class Document
key
- the key.@Nullable public MutableDictionary getDictionary(@NonNull String key)
getDictionary
in interface DictionaryInterface
getDictionary
in interface MutableDictionaryInterface
getDictionary
in class Document
key
- the key.@NonNull public String toJSON()
toJSON
in interface DictionaryInterface
toJSON
in class Document