public class ArrayEditor extends Object implements EditableArray
Array.EntryDocument.Field, Document.ValueTransformer| Constructor and Description |
|---|
ArrayEditor(MutableArray array,
DocumentValueFactory factory) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
Object element) |
boolean |
add(Object e) |
boolean |
addAll(Collection<? extends Object> c) |
boolean |
addAll(int index,
Collection<? extends Object> c) |
EditableArray |
addArray()
Adds to this array a new empty array.
|
EditableArray |
addArray(Array array)
Adds to this array the supplied array.
|
EditableArray |
addArray(int index)
Insert the value for the field at the given index to be a new, empty array.
|
EditableArray |
addArray(int index,
Array array)
Insert the value for the field at the given index to be the supplied array.
|
EditableArray |
addArrayIfAbsent(Array array)
Adds to this array the supplied array, if and only if an equivalent value doesn't already exist in the array.
|
EditableArray |
addBinary(byte type,
byte[] data)
Adds to this array a
Binary value with the supplied type and content. |
EditableArray |
addBinary(int index,
byte type,
byte[] data)
Insert the value for the field at the given index to be a binary value.
|
EditableArray |
addBinaryIfAbsent(byte type,
byte[] data)
Adds to this array a
Binary value with the supplied type and content, if and only if an equivalent value doesn't
already exist in the array. |
EditableArray |
addBoolean(boolean value)
Adds the supplied boolean value to this array.
|
EditableArray |
addBoolean(int index,
boolean value)
Insert the value for the field at the given index to the supplied boolean value.
|
EditableArray |
addBooleanIfAbsent(boolean value)
Adds the supplied boolean value to this array, if and only if an equivalent value doesn't already exist in the array.
|
EditableDocument |
addCode(int index,
String code,
boolean includeScope)
Insert the value for the field at the given index to be a
Code or CodeWithScope. |
EditableDocument |
addCode(int index,
String code,
Document scope)
Insert the value for the field at the given index to be a
Code or CodeWithScope. |
EditableDocument |
addCode(String code,
boolean includeScope)
Adds to this array a
Code with the supplied JavaScript code. |
EditableDocument |
addCode(String code,
Document scope)
Adds to this array a
CodeWithScope with the supplied JavaScript code and scope. |
EditableDocument |
addCodeIfAbsent(String code,
Document scope)
Adds to this array a
CodeWithScope with the supplied JavaScript code and scope, if and only if an equivalent value
doesn't already exist in the array. |
EditableArray |
addDate(Date value)
Adds to this array the supplied date.
|
EditableArray |
addDate(int index,
Date value)
Insert the value for the field at the given index to the supplied date value.
|
EditableArray |
addDate(int index,
String isoDate)
Insert the value for the field at the given index to the date value parsed from the ISO-8601 date representation.
|
EditableArray |
addDate(String isoDate)
Adds to this array a Date with the supplied ISO-8601 string.
|
EditableArray |
addDateIfAbsent(Date value)
Adds to this array the supplied date, if and only if an equivalent value doesn't already exist in the array.
|
EditableArray |
addDateIfAbsent(String isoDate)
Adds to this array a Date with the supplied ISO-8601 string, if and only if an equivalent value doesn't already exist in
the array.
|
EditableDocument |
addDocument()
Adds to this array a new empty document.
|
EditableDocument |
addDocument(Document document)
Adds to this array the supplied document.
|
EditableDocument |
addDocument(int index)
Insert the value for the field at the given index to be a new, empty Document.
|
EditableDocument |
addDocument(int index,
Document document)
Insert the value for the field at the given index to be the supplied Document.
|
EditableDocument |
addDocumentIfAbsent(Document document)
Adds to this array the supplied document, if and only if an equivalent value doesn't already exist in the array.
|
EditableArray |
addNull()
Adds to this array a
Null value. |
EditableArray |
addNull(int index)
Insert the value for the field at the given index to be a null value.
|
EditableArray |
addNullIfAbsent()
Adds to this array a
Null value, if and only if there is not already a null value in the array. |
EditableArray |
addNumber(double value)
Adds the supplied double value to this array.
|
EditableArray |
addNumber(float value)
Adds the supplied float value to this array.
|
EditableArray |
addNumber(int value)
Adds the supplied integer value to this array.
|
EditableArray |
addNumber(int index,
double value)
Insert the value for the field at the given index to the supplied double value.
|
EditableArray |
addNumber(int index,
float value)
Insert the value for the field at the given index to the supplied float value.
|
EditableArray |
addNumber(int index,
int value)
Insert the value for the field at the given index to the supplied integer value.
|
EditableArray |
addNumber(int index,
long value)
Insert the value for the field at the given index to the supplied long value.
|
EditableArray |
addNumber(long value)
Adds the supplied long value to this array.
|
EditableArray |
addNumberIfAbsent(double value)
Adds the supplied double value to this array, if and only if an equivalent value doesn't already exist in the array.
|
EditableArray |
addNumberIfAbsent(float value)
Adds the supplied float value to this array, if and only if an equivalent value doesn't already exist in the array.
|
EditableArray |
addNumberIfAbsent(int value)
Adds the supplied integer value to this array, if and only if an equivalent value doesn't already exist in the array.
|
EditableArray |
addNumberIfAbsent(long value)
Adds the supplied long value to this array, if and only if an equivalent value doesn't already exist in the array.
|
EditableArray |
addObjectId(byte[] bytes)
Adds to this array an ObjectId with the supplied 12-byte value.
|
EditableArray |
addObjectId(int index,
byte[] bytes)
Insert the value for the field at the given index to an
ObjectId created from the supplied 12-byte binary value. |
EditableArray |
addObjectId(int time,
int machine,
int process,
int inc)
Adds to this array an ObjectId with the supplied time, machine, process, and increment.
|
EditableArray |
addObjectId(int index,
int time,
int machine,
int process,
int inc)
Insert the value for the field at the given index to an
ObjectId created from the supplied hexadecimal binary
value. |
EditableArray |
addObjectId(int index,
String hex)
Insert the value for the field at the given index to an
ObjectId created from the supplied hexadecimal binary
value. |
EditableArray |
addObjectId(String hex)
Adds to this array an ObjectId with the supplied hexadecimal string.
|
EditableArray |
addObjectIdIfAbsent(byte[] bytes)
Adds to this array an ObjectId with the supplied 12-byte value, if and only if an equivalent value doesn't already exist in
the array.
|
EditableArray |
addObjectIdIfAbsent(int time,
int machine,
int process,
int inc)
Adds to this array an ObjectId with the supplied time, machine, process, and increment, if and only if an equivalent value
doesn't already exist in the array.
|
EditableArray |
addObjectIdIfAbsent(String hex)
Adds to this array an ObjectId with the supplied hexadecimal string, if and only if an equivalent value doesn't already
exist in the array.
|
EditableArray |
addRegularExpression(int index,
String pattern)
Insert the value for the field at the given index to the supplied regular expression.
|
EditableArray |
addRegularExpression(int index,
String pattern,
int flags)
Insert the value for the field at the given index to the supplied regular expression.
|
EditableArray |
addRegularExpression(String pattern)
Adds to this array a regular expression with the supplied pattern string.
|
EditableArray |
addRegularExpression(String pattern,
int flags)
Adds to this array a regular expression with the supplied pattern string and option flags.
|
EditableArray |
addRegularExpressionIfAbsent(String pattern)
Adds to this array a regular expression with the supplied pattern string, if and only if an equivalent value doesn't
already exist in the array.
|
EditableArray |
addRegularExpressionIfAbsent(String pattern,
int flags)
Adds to this array a regular expression with the supplied pattern string and option flags, if and only if an equivalent
value doesn't already exist in the array.
|
EditableArray |
addString(int index,
String value)
Insert the value for the field at the given index to the supplied string value.
|
EditableArray |
addString(String value)
Adds the supplied string value to this array.
|
EditableArray |
addStringIfAbsent(String value)
Adds the supplied string value to this array, if and only if an equivalent value doesn't already exist in the array.
|
EditableArray |
addSymbol(int index,
String value)
Insert the value for the field at the given index to a
Symbol created from the supplied string value. |
EditableArray |
addSymbol(String value)
Adds to this array a Symbol with the supplied string.
|
EditableArray |
addSymbolIfAbsent(String value)
Adds to this array a Symbol with the supplied string, if and only if an equivalent value doesn't already exist in the
array.
|
EditableArray |
addTimestamp(int timeInSeconds,
int increment)
Adds to this array a Timestamp with the supplied time in seconds and increment value.
|
EditableArray |
addTimestamp(int index,
int timeInSeconds,
int increment)
Insert the value for the field at the given index to a
Timestamp with the supplied time in seconds and increment. |
EditableArray |
addTimestampIfAbsent(int timeInSeconds,
int increment)
Adds to this array a Timestamp with the supplied time in seconds and increment value, if and only if an equivalent value
doesn't already exist in the array.
|
EditableArray |
addUuid(int index,
UUID uuid)
Insert the value for the field at the given index to be a
UUID. |
EditableArray |
addUuid(UUID uuid)
Adds to this array the supplied UUID.
|
EditableArray |
addUuidIfAbsent(UUID uuid)
Adds to this array the supplied UUID, if and only if an equivalent value doesn't already exist in the array.
|
EditableArray |
addValue(int index,
Object value)
Insert the value for the field with the given name to the supplied value.
|
EditableArray |
addValue(Object value)
Add the supplied value to this array.
|
EditableArray |
addValueIfAbsent(Object value)
Add the supplied value to this array if and only if there is not already an equivalent value in the array.
|
MutableArray |
asMutableArray()
Return the array that was edited.
|
void |
clear() |
ArrayEditor |
clone()
Obtain a clone of this document.
|
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
containsAll(Document document)
Checks if this object contains all of the fields in the supplied document.
|
boolean |
containsField(String name)
Checks if this object contains a field with the given name.
|
protected EditableArray |
createEditableArray(MutableArray array,
int index,
DocumentValueFactory factory) |
protected EditableDocument |
createEditableDocument(MutableDocument document,
int index,
DocumentValueFactory factory) |
protected EditableArray |
createEditableSublist(MutableArray array,
DocumentValueFactory factory) |
protected boolean |
doAddAll(Collection<? extends Object> c) |
protected boolean |
doAddAll(int index,
Collection<? extends Object> c) |
protected void |
doAddValue(int index,
Object value) |
protected int |
doAddValue(Object value) |
protected boolean |
doAddValueIfAbsent(Object value) |
protected void |
doClear() |
protected List<Array.Entry> |
doRemoveAll(Collection<?> c) |
protected Object |
doRemoveValue(int index) |
protected boolean |
doRemoveValue(Object value) |
protected List<Array.Entry> |
doRetainAll(Collection<?> c) |
protected Object |
doSetValue(int index,
Object value) |
protected Object |
doSetValue(String name,
Object value) |
protected EditableDocument |
editable(Document doc,
int index) |
protected EditableArray |
editable(List<?> array,
int index) |
Iterable<Document.Field> |
fields()
Obtain an iterator over the
Document.Fields in this object. |
Object |
get(int index) |
Object |
get(String name)
Gets the value in this document for the given field name.
|
EditableArray |
getArray(String name)
Get the existing array value in this array for the given index.
|
Binary |
getBinary(String name)
Get the
Binary value in this document for the given field name. |
Boolean |
getBoolean(String name)
Get the boolean value in this document for the given field name.
|
boolean |
getBoolean(String name,
boolean defaultValue)
Get the boolean value in this document for the given field name.
|
Code |
getCode(String name)
Get the
Code value in this document for the given field name. |
CodeWithScope |
getCodeWithScope(String name)
Get the
CodeWithScope value in this document for the given field name. |
EditableDocument |
getDocument(String name)
Get the existing document value in this array for the given index.
|
Double |
getDouble(String name)
Get the double value in this document for the given field name.
|
double |
getDouble(String name,
double defaultValue)
Get the double value in this document for the given field name.
|
Iterable<Array.Entry> |
getEntries()
Get the entries in this array.
|
Integer |
getInteger(String name)
Get the integer value in this document for the given field name.
|
int |
getInteger(String name,
int defaultValue)
Get the integer value in this document for the given field name.
|
Long |
getLong(String name)
Get the integer value in this document for the given field name.
|
long |
getLong(String name,
long defaultValue)
Get the long value in this document for the given field name.
|
MaxKey |
getMaxKey(String name)
Get the
MaxKey value in this document for the given field name. |
MinKey |
getMinKey(String name)
Get the
MinKey value in this document for the given field name. |
Number |
getNumber(String name)
Get the number value in this document for the given field name.
|
Number |
getNumber(String name,
Number defaultValue)
Get the number value in this document for the given field name.
|
ObjectId |
getObjectId(String name)
Get the
ObjectId value in this document for the given field name. |
EditableArray |
getOrCreateArray(String name)
Get the existing array value in this document for the given field name, or create a new array if there is no existing array
at this field.
|
EditableDocument |
getOrCreateDocument(String name)
Get the existing document value in this document for the given field name, or create a new document if there is no existing
document at this field.
|
Pattern |
getPattern(String name)
Get the
Pattern value in this document for the given field name. |
String |
getString(String name)
Get the string value in this document for the given field name.
|
String |
getString(String name,
String defaultValue)
Get the string value in this document for the given field name.
|
Symbol |
getSymbol(String name)
Get the
Symbol value in this document for the given field name. |
int |
getType(String name)
Get the
Bson.Type constant that describes the type of value for the given field name. |
UUID |
getUuid(String name)
Get the
UUID value in this document for the given field name. |
UUID |
getUuid(String name,
UUID defaultValue)
Get the
UUID value in this document for the given field name. |
protected int |
indexFrom(String name) |
int |
indexOf(Object o) |
boolean |
isEmpty()
Return whether this document contains no fields and is therefore empty.
|
boolean |
isNull(String name)
Determine whether this object has a pair with the given the name and the value is null.
|
boolean |
isNullOrMissing(String name)
Determine whether this object has a pair with the given the name and the value is null, or if this object has no field with
the given name.
|
Iterator<Object> |
iterator() |
Set<String> |
keySet()
Returns this object's fields' names
|
int |
lastIndexOf(Object o) |
ListIterator<Object> |
listIterator() |
ListIterator<Object> |
listIterator(int index) |
void |
merge(Document other)
Merges the supplied document onto this document.
|
Object |
put(String name,
Object value) |
void |
putAll(Document object)
Sets on this object all name/value pairs from the supplied object.
|
void |
putAll(Map<? extends String,? extends Object> map)
Sets on this object all key/value pairs from the supplied map.
|
Object |
remove(int index) |
boolean |
remove(Object o) |
Object |
remove(String name)
Remove the field with the supplied name, and return the value.
|
void |
removeAll()
Remove all fields from this document.
|
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
Object |
set(int index,
Object element) |
EditableArray |
set(String name,
Object value)
Set the value for the field with the given name to the supplied value.
|
EditableArray |
setArray(int index)
Set the value for the field at the given index to be a new, empty array.
|
EditableArray |
setArray(int index,
Array array)
Set the value for the field at the given index to be the supplied array.
|
EditableArray |
setArray(String name)
Set the value for the field at the given index to be a new, empty array.
|
EditableArray |
setArray(String name,
Array array)
Set the value for the field at the given index to be the supplied array.
|
EditableArray |
setArray(String name,
Object... values)
Set the value for the field with the given name to be the supplied array.
|
EditableArray |
setBinary(int index,
byte type,
byte[] data)
Set the value for the field at the given index to be a binary value.
|
EditableArray |
setBinary(String name,
byte type,
byte[] data)
Set the value for the field at the given index to be a binary value.
|
EditableArray |
setBoolean(int index,
boolean value)
Set the value for the field at the given index to the supplied boolean value.
|
EditableArray |
setBoolean(String name,
boolean value)
Set the value for the field at the given index to the supplied boolean value.
|
EditableDocument |
setCode(int index,
String code,
boolean includeScope)
Set the value for the field at the given index to be a
Code or CodeWithScope. |
EditableDocument |
setCode(int index,
String code,
Document scope)
Set the value for the field at the given index to be a
Code or CodeWithScope. |
EditableDocument |
setCode(String name,
String code,
boolean includeScope)
Set the value for the field at the given index to be a
Code or CodeWithScope. |
EditableDocument |
setCode(String name,
String code,
Document scope)
Set the value for the field at the given index to be a
Code or CodeWithScope. |
EditableArray |
setDate(int index,
Date value)
Set the value for the field at the given index to the supplied date value.
|
EditableArray |
setDate(int index,
String isoDate)
Set the value for the field at the given index to the date value parsed from the ISO-8601 date representation.
|
EditableArray |
setDate(String name,
Date value)
Set the value for the field at the given index to the supplied date value.
|
EditableArray |
setDate(String name,
String isoDate)
Set the value for the field at the given index to the date value parsed from the ISO-8601 date representation.
|
EditableDocument |
setDocument(int index)
Set the value for the field at the given index to be a new, empty Document.
|
EditableDocument |
setDocument(int index,
Document document)
Set the value for the field at the given index to be the supplied Document.
|
EditableDocument |
setDocument(String name)
Set the value for the field at the given index to be a new, empty Document.
|
EditableDocument |
setDocument(String name,
Document document)
Set the value for the field at the given index to be the supplied Document.
|
EditableArray |
setNull(int index)
Set the value for the field at the given index to be a null value.
|
EditableArray |
setNull(String name)
Set the value for the field at the given index to be a null value.
|
EditableArray |
setNumber(int index,
double value)
Set the value for the field at the given index to the supplied double value.
|
EditableArray |
setNumber(int index,
float value)
Set the value for the field at the given index to the supplied float value.
|
EditableArray |
setNumber(int index,
int value)
Set the value for the field at the given index to the supplied integer value.
|
EditableArray |
setNumber(int index,
long value)
Set the value for the field at the given index to the supplied long value.
|
EditableArray |
setNumber(String name,
double value)
Set the value for the field at the given index to the supplied double value.
|
EditableArray |
setNumber(String name,
float value)
Set the value for the field at the given index to the supplied float value.
|
EditableArray |
setNumber(String name,
int value)
Set the value for the field at the given index to the supplied integer value.
|
EditableArray |
setNumber(String name,
long value)
Set the value for the field at the given index to the supplied long value.
|
EditableArray |
setObjectId(int index,
byte[] bytes)
Set the value for the field at the given index to an
ObjectId created from the supplied 12-byte binary value. |
EditableArray |
setObjectId(int index,
int time,
int machine,
int process,
int inc)
Set the value for the field at the given index to an
ObjectId created from the supplied hexadecimal binary value. |
EditableArray |
setObjectId(int index,
String hex)
Set the value for the field at the given index to an
ObjectId created from the supplied hexadecimal binary value. |
EditableArray |
setObjectId(String name,
byte[] bytes)
Set the value for the field at the given index to an
ObjectId created from the supplied 12-byte binary value. |
EditableArray |
setObjectId(String name,
int time,
int machine,
int process,
int inc)
Set the value for the field at the given index to an
ObjectId created from the supplied hexadecimal binary value. |
EditableArray |
setObjectId(String name,
String hex)
Set the value for the field at the given index to an
ObjectId created from the supplied hexadecimal binary value. |
EditableArray |
setRegularExpression(int index,
String pattern)
Set the value for the field at the given index to the supplied regular expression.
|
EditableArray |
setRegularExpression(int index,
String pattern,
int flags)
Set the value for the field at the given index to the supplied regular expression.
|
EditableArray |
setRegularExpression(String name,
String pattern)
Set the value for the field at the given index to the supplied regular expression.
|
EditableArray |
setRegularExpression(String name,
String pattern,
int flags)
Set the value for the field at the given index to the supplied regular expression.
|
EditableArray |
setString(int index,
String value)
Set the value for the field at the given index to the supplied string value.
|
EditableArray |
setString(String name,
String value)
Set the value for the field at the given index to the supplied string value.
|
EditableArray |
setSymbol(int index,
String value)
Set the value for the field at the given index to a
Symbol created from the supplied string value. |
EditableArray |
setSymbol(String name,
String value)
Set the value for the field at the given index to a
Symbol created from the supplied string value. |
EditableArray |
setTimestamp(int index,
int timeInSeconds,
int increment)
Set the value for the field at the given index to a
Timestamp with the supplied time in seconds and increment. |
EditableArray |
setTimestamp(String name,
int timeInSeconds,
int increment)
Set the value for the field at the given index to a
Timestamp with the supplied time in seconds and increment. |
EditableArray |
setUuid(int index,
UUID uuid)
Set the value for the field at the given index to be a
UUID. |
EditableArray |
setUuid(String name,
UUID uuid)
Set the value for the field at the given index to be a
UUID. |
EditableArray |
setValue(int index,
Object value)
Set the value for the field with the given name to the supplied value.
|
protected EditableArray |
setValue(String name,
Object value) |
int |
size()
Return the number of name-value pairs in this object.
|
List<Object> |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
Map<String,? extends Object> |
toMap()
Returns a map representing this BSONObject.
|
String |
toString() |
Array |
unwrap()
Unwrap this editor to obtain the potentially wrapped document.
|
ArrayEditor |
with(Document.ValueTransformer transformer)
Obtain a clone of this document, but with the field values transformed using the supplied
Document.ValueTransformer. |
ArrayEditor |
with(Map<String,Object> changedFields)
Obtain a clone of this document, but with the supplied fields replaced.
|
Document |
with(String fieldName,
Object value)
Obtain a clone of this document, but with the supplied fields replaced.
|
Document |
withVariablesReplaced(Properties properties)
Obtain a clone of this document, but with all variables in string field values replaced with the referenced values from the
supplied properties.
|
Document |
withVariablesReplacedWithSystemProperties()
Obtain a clone of this document, but with all variables in string field values replaced with the referenced values from the
System properties.
|
public ArrayEditor(MutableArray array, DocumentValueFactory factory)
public ArrayEditor clone()
Documentpublic ArrayEditor with(Map<String,Object> changedFields)
Documentpublic Document with(String fieldName, Object value)
Documentpublic ArrayEditor with(Document.ValueTransformer transformer)
DocumentDocument.ValueTransformer.public Document withVariablesReplaced(Properties properties)
DocumentVariables may appear anywhere within a string value, and multiple variables can be used within the same value. Variables take the form:
variable := '${' variableNames [ ':' defaultValue ] '}'
variableNames := variableName [ ',' variableNames ]
variableName := /* any characters except ',' and ':' and '}'
defaultValue := /* any characters except
Note that variableName is the name used to look up the Properties property.
Notice that the syntax supports multiple variables. The logic will process the variables from let to right,
until an existing System property is found. And at that point, it will stop and will not attempt to find values for the
other variables.
withVariablesReplaced in interface Documentproperties - the properties keyed by variable nameDocument.withVariablesReplacedWithSystemProperties(),
Document.with(ValueTransformer),
SchemaLibrary.convertValues(Document, String)public Document withVariablesReplacedWithSystemProperties()
DocumentVariables may appear anywhere within a string value, and multiple variables can be used within the same value. Variables take the form:
variable := '${' variableNames [ ':' defaultValue ] '}'
variableNames := variableName [ ',' variableNames ]
variableName := /* any characters except ',' and ':' and '}'
defaultValue := /* any characters except
Note that variableName is the name used to look up a System property via System.getProperty(String).
Notice that the syntax supports multiple variables. The logic will process the variables from let to right,
until an existing System property is found. And at that point, it will stop and will not attempt to find values for the
other variables.
Because only string values can contain variables, the resulting values are left as strings. This may not be valid according
to the document's JSON Schema, so see SchemaLibrary.convertValues(Document, String) to convert the string values
after variable substitution into the expected non-string types.
withVariablesReplacedWithSystemProperties in interface DocumentDocument.withVariablesReplaced(Properties),
Document.with(ValueTransformer),
SchemaLibrary.convertValues(Document, String)public Array unwrap()
EditableDocumentunwrap in interface EditableDocumentpublic MutableArray asMutableArray()
public Object get(String name)
Documentpublic Boolean getBoolean(String name)
DocumentgetBoolean in interface Documentname - The name of the pairpublic boolean getBoolean(String name, boolean defaultValue)
DocumentgetBoolean in interface Documentname - The name of the pairdefaultValue - the default value to return if there is no such pair or if the value is not a booleandefaultValue if there is no such pair or if the value is not a
booleanpublic void putAll(Document object)
EditableDocumentputAll in interface EditableDocumentobject - the object containing the name/value pairs to be set on this objectpublic void putAll(Map<? extends String,? extends Object> map)
EditableDocumentputAll in interface EditableDocumentmap - the map containing the name/value pairs to be set on this objectpublic void merge(Document other)
EditableDocumentConsider the following example. If this document contains:
{
"firstName" : "Jane",
"lastName" : "Smith",
"address" : {
"street" : "Main Street",
"city" : "Springfield"
},
"phone" : "(800)555-1212"
}
and another document 'other' contains:
{
"lastName" : "Doe",
"address" : {
"city" : "Memphis",
"zip" : 12345
},
"phone" : {
"home" : "(800)555-1212"
}
}
then merging 'other' onto the first will result in the first being modified to contain:
{
"firstName" : "Jane",
"lastName" : "Doe",
"address" : {
"street" : "Main Street",
"city" : "Memphis",
"zip" : 12345
},
"phone" : {
"home" : "(800)555-1212"
}
}
merge in interface EditableDocumentother - the other document whose values should be mergedpublic Object remove(String name)
EditableDocumentremove in interface EditableDocumentname - The name of the fieldpublic Integer getInteger(String name)
DocumentgetInteger in interface Documentname - The name of the pairpublic int getInteger(String name, int defaultValue)
DocumentgetInteger in interface Documentname - The name of the pairdefaultValue - the default value to return if there is no such pair or if the value is not a integerdefaultValue if there is no such pair or if the value is not a
integerpublic Long getLong(String name)
Documentpublic long getLong(String name, long defaultValue)
DocumentgetLong in interface Documentname - The name of the pairdefaultValue - the default value to return if there is no such pair or if the value is not a long valuedefaultValue if there is no such pair or if the value is not a long
valuepublic Double getDouble(String name)
Documentpublic double getDouble(String name, double defaultValue)
Documentpublic Number getNumber(String name)
Documentpublic Number getNumber(String name, Number defaultValue)
Documentpublic String getString(String name)
DocumentSymbol.public String getString(String name, String defaultValue)
DocumentSymbol.public EditableArray getArray(String name)
EditableArraygetArray in interface DocumentgetArray in interface EditableArraygetArray in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraypublic EditableArray getOrCreateArray(String name)
EditableDocumentgetOrCreateArray in interface EditableDocumentname - The name of the pairpublic EditableDocument getDocument(String name)
EditableArraygetDocument in interface DocumentgetDocument in interface EditableArraygetDocument in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraypublic EditableDocument getOrCreateDocument(String name)
EditableDocumentgetOrCreateDocument in interface EditableDocumentname - The name of the pairpublic boolean isNull(String name)
Documentthis.get(name) instanceof Null;
isNull in interface Documentname - The name of the pairtrue if the field has been set to a Null value, or false otherwiseDocument.isNullOrMissing(String)public boolean isNullOrMissing(String name)
DocumentNull.matches(this.get(name));
isNullOrMissing in interface Documentname - The name of the pairtrue if the field value for the name is null or if there is no such field.Document.isNull(String)public MaxKey getMaxKey(String name)
DocumentMaxKey value in this document for the given field name.public MinKey getMinKey(String name)
DocumentMinKey value in this document for the given field name.public Code getCode(String name)
DocumentCode value in this document for the given field name.public CodeWithScope getCodeWithScope(String name)
DocumentCodeWithScope value in this document for the given field name.getCodeWithScope in interface Documentname - The name of the pairCodeWithScope field value, if found, or null if there is no such pair or if the value is not a
CodeWithScopepublic ObjectId getObjectId(String name)
DocumentObjectId value in this document for the given field name.getObjectId in interface Documentname - The name of the pairObjectId field value, if found, or null if there is no such pair or if the value is not a
ObjectIdpublic Binary getBinary(String name)
DocumentBinary value in this document for the given field name.public Symbol getSymbol(String name)
DocumentSymbol value in this document for the given field name.public Pattern getPattern(String name)
DocumentPattern value in this document for the given field name.getPattern in interface Documentname - The name of the pairPattern field value, if found, or null if there is no such pair or if the value is not a
Patternpublic UUID getUuid(String name)
DocumentUUID value in this document for the given field name.public UUID getUuid(String name, UUID defaultValue)
DocumentUUID value in this document for the given field name.getUuid in interface Documentname - The name of the pairdefaultValue - the default value to return if there is no such pair or if the value is not a stringUUID field value if found, or defaultValue if there is no such pair or if the value is not
a UUID (or a string that is convertable from a UUID)public int getType(String name)
DocumentBson.Type constant that describes the type of value for the given field name.public Map<String,? extends Object> toMap()
Documentpublic Iterable<Document.Field> fields()
DocumentDocument.Fields in this object.public boolean containsField(String name)
DocumentcontainsField in interface Documentname - The name of the pair for which to checkpublic boolean containsAll(Document document)
DocumentcontainsAll in interface Documentdocument - The document with the fields that should be in this documentpublic Set<String> keySet()
Documentpublic int size()
Documentpublic void removeAll()
EditableDocumentremoveAll in interface EditableDocumentpublic EditableArray setBoolean(String name, boolean value)
EditableArraysetBoolean in interface EditableArraysetBoolean in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayvalue - the new value for the fieldpublic EditableArray setNumber(String name, int value)
EditableArraysetNumber in interface EditableArraysetNumber in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayvalue - the new value for the fieldpublic EditableArray setNumber(String name, long value)
EditableArraysetNumber in interface EditableArraysetNumber in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayvalue - the new value for the fieldpublic EditableArray setNumber(String name, float value)
EditableArraysetNumber in interface EditableArraysetNumber in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayvalue - the new value for the fieldpublic EditableArray setNumber(String name, double value)
EditableArraysetNumber in interface EditableArraysetNumber in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayvalue - the new value for the fieldpublic EditableArray setString(String name, String value)
EditableArraysetString in interface EditableArraysetString in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayvalue - the new value for the fieldpublic EditableArray setSymbol(String name, String value)
EditableArraySymbol created from the supplied string value. Symbols are
defined in the BSON specification as being similar to a string but which exists for those languages that have a specific
symbol type. Symbols are serialized to JSON as a normal string.setSymbol in interface EditableArraysetSymbol in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayvalue - the new value for the fieldEditableArray.setString(String, String)public EditableDocument setDocument(String name)
EditableArraysetDocument in interface EditableArraysetDocument in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraypublic EditableDocument setDocument(String name, Document document)
EditableArraysetDocument in interface EditableArraysetDocument in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraydocument - the documentdocument.public EditableArray setArray(String name)
EditableArraysetArray in interface EditableArraysetArray in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraypublic EditableArray setArray(String name, Array array)
EditableArraysetArray in interface EditableArraysetArray in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayarray - the arrayarray.public EditableArray setArray(String name, Object... values)
EditableDocumentsetArray in interface EditableDocumentname - The name of the fieldvalues - the (valid) values for the arrayarray.public EditableArray setDate(String name, Date value)
EditableArraysetDate in interface EditableArraysetDate in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayvalue - the new value for the fieldpublic EditableArray setDate(String name, String isoDate) throws ParseException
EditableArrayyyyy-MM-ddTHH:mm:ss" where "T" is a literal
characteryyyy-MM-ddTHH:mm:ssZ" where "T" and "
Z" are literal charactersyyyy-MM-ddTHH:mm:ssGMT+00:00" where "
T", and "GMT" are literal characterssetDate in interface EditableArraysetDate in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayisoDate - the new value for the fieldParseException - if the supplied value could not be parsed into a valid datepublic EditableArray setTimestamp(String name, int timeInSeconds, int increment)
EditableArrayTimestamp with the supplied time in seconds and increment. Note
that Date values are recommended for most purposes, as they are better suited to most applications' representations
of time instants.setTimestamp in interface EditableArraysetTimestamp in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraytimeInSeconds - the time in seconds for the new Timestampincrement - the time increment for the new TimestampEditableArray.setDate(String, Date)public EditableArray setObjectId(String name, String hex)
EditableArrayObjectId created from the supplied hexadecimal binary value.
Object IDs are defined by the BSON specification as 12-byte binary values designed to have a reasonably high probability of
being unique when allocated. Since there is no explicit way to represent these in a JSON document, each ObjectId value is
serialized in a JSON document as a nested document of the form:
{ "$oid" : "12bytesOfIdInBase16" }
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to an ObjectId value.
For example, an ObjectId with time value of "1310745823", machine value of "1", process value of "2", and increment value of "3" would be written as
{ "$oid" : "4e2064df0000010002000003" }
setObjectId in interface EditableArraysetObjectId in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayhex - the hexadecimal binary value for the ObjectIdEditableArray.setObjectId(String, byte[]),
EditableArray.setObjectId(String, int, int, int, int)public EditableArray setObjectId(String name, byte[] bytes)
EditableArrayObjectId created from the supplied 12-byte binary value.
Object IDs are defined by the BSON specification as 12-byte binary values designed to have a reasonably high probability of
being unique when allocated. Since there is no explicit way to represent these in a JSON document, each ObjectId value is
serialized in a JSON document as a nested document of the form:
{ "$oid" : "12bytesOfIdInBase16" }
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to an ObjectId value.
For example, an ObjectId with time value of "1310745823", machine value of "1", process value of "2", and increment value of "3" would be written as
{ "$oid" : "4e2064df0000010002000003" }
setObjectId in interface EditableArraysetObjectId in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraybytes - the 12-byte value for the ObjectIdEditableArray.setObjectId(String, String),
EditableArray.setObjectId(String, int, int, int, int)public EditableArray setObjectId(String name, int time, int machine, int process, int inc)
EditableArrayObjectId created from the supplied hexadecimal binary value.
Object IDs are defined by the BSON specification as 12-byte binary values designed to have a reasonably high probability of
being unique when allocated. Since there is no explicit way to represent these in a JSON document, each ObjectId value is
serialized in a JSON document as a nested document of the form:
{ "$oid" : "12bytesOfIdInBase16" }
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to an ObjectId value.
For example, an ObjectId with time value of "1310745823", machine value of "1", process value of "2", and increment value of "3" would be written as
{ "$oid" : "4e2064df0000010002000003" }
setObjectId in interface EditableArraysetObjectId in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraytime - the Unix-style timestamp, which is a signed integer representing the number of seconds before or after January
1st 1970 (UTC)machine - the first three bytes of the (md5) hash of the machine host name, or of the mac/network address, or the
virtual machine idprocess - the 2 bytes of the process id (or thread id) of the process generating the object idinc - an ever incrementing value, or a random number if a counter can't be used in the language/runtimeEditableArray.setObjectId(String, String),
EditableArray.setObjectId(String, byte[])public EditableArray setRegularExpression(String name, String pattern)
EditableArrayPattern instances, and are stored natively in BSON as regular expressions. However,
when serialized to JSON, regular expressions are written as nested documents of the form:
{ "$regex" : "pattern" }
where "pattern" is the regular expression pattern.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to a regular expression value.
setRegularExpression in interface EditableArraysetRegularExpression in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraypattern - the regular expression pattern stringEditableArray.setRegularExpression(String, String, int)public EditableArray setRegularExpression(String name, String pattern, int flags)
EditableArrayPattern instances, and are stored natively in BSON as regular expressions. However,
when serialized to JSON, regular expressions are written as nested documents of the form:
{ "$regex" : "pattern", "$options" : "flags" }
where "pattern" is the regular expression pattern, and "flags" is a string representation of the regular
expression options.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to a regular expression value.
setRegularExpression in interface EditableArraysetRegularExpression in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraypattern - the regular expression pattern stringflags - the bitwise-anded Pattern options: Pattern.CANON_EQ, Pattern.CASE_INSENSITIVE,
Pattern.CASE_INSENSITIVE, Pattern.COMMENTS, Pattern.DOTALL, Pattern.LITERAL,
Pattern.MULTILINE, Pattern.UNICODE_CASE, and Pattern.UNIX_LINESEditableArray.setRegularExpression(String, String)public EditableArray setNull(String name)
EditableArrayNull is used for the value in the in-memory representation. The Document.isNull(String) methods can be used to
determine if a field has been set to null, or Document.isNullOrMissing(String) if the field has not be set or if it has
been set to null.setNull in interface EditableArraysetNull in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayDocument.isNull(String),
Document.isNullOrMissing(String)public EditableArray setBinary(String name, byte type, byte[] data)
EditableArray
{ "$type" : typeAsInt, "$base64" : "bytesInBase64" }
where "typeAsInt" is the integer representation of the BSON type, and "bytesInBase64" is
the Base64 encoding of the actual Binary bytes.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to Binary value.
setBinary in interface EditableArraysetBinary in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraytype - one of the BSON type constants denoting the type of the Binary valuedata - the bytes for the Binary valuepublic EditableArray setUuid(String name, UUID uuid)
EditableArrayUUID. JSON does not formally support binary values, and so
such values will be encoded using a nested document of the form:
{ "$uuid" : "string-form-of-uuid" }
where "string-form-of-uuid" is the UUID's string representation
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to UUID value.
setUuid in interface EditableArraysetUuid in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arrayuuid - the UUID valuepublic EditableDocument setCode(String name, String code, boolean includeScope)
EditableArrayCode or CodeWithScope. JSON does not formally
support such values, and so when written to JSON they will be encoded using a nested document of the form:
{ "$code" : "code" }
or, if there is a scope document
{ "$code" : "code", "$scope" : scope document }
where "code" is the Code's JavaScript code and scopeDocument is the nested
document representing the scope in which the JavaScript code should be evaluated.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to Code or CodeWithScope value.
Note that when includeScope is true, the returned EditableArray can be used to populate
the scope document.
setCode in interface EditableArraysetCode in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraycode - the codeincludeScope - true if the code should include a scope (and if this method should return an EditableArray for
this scope document), or false otherwiseincludeScope is true, then the EditableDocument for the scope; otherwise, this
array to allow for chaining methodsEditableArray.setCode(String, String, Document)public EditableDocument setCode(String name, String code, Document scope)
EditableArrayCode or CodeWithScope. JSON does not formally
support such values, and so when written to JSON they will be encoded using a nested document of the form:
{ "$code" : "code" }
or, if there is a scope document
{ "$code" : "code", "$scope" : scope document }
where "code" is the Code's JavaScript code and scopeDocument is the nested
document representing the scope in which the JavaScript code should be evaluated.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to Code or CodeWithScope value.
setCode in interface EditableArraysetCode in interface EditableDocumentname - The name of the field, which is the string representation of the index in the arraycode - the codescope - the scope in which the JavaScript code should be evaulated, or null if there is no scopeEditableDocument for the scopeEditableArray.setCode(String, String, boolean)protected EditableArray setValue(String name, Object value)
public EditableArray setValue(int index, Object value)
EditableArraysetValue in interface EditableArrayindex - The index in the arrayvalue - the new valuepublic EditableArray addValue(Object value)
EditableArrayaddValue in interface EditableArrayvalue - the new valuepublic EditableArray addValueIfAbsent(Object value)
EditableArrayaddValueIfAbsent in interface EditableArrayvalue - the valuepublic EditableArray addValue(int index, Object value)
EditableArrayaddValue in interface EditableArrayindex - The index in the arrayvalue - the new valueprotected final int indexFrom(String name)
protected int doAddValue(Object value)
protected void doAddValue(int index,
Object value)
protected boolean doAddValueIfAbsent(Object value)
protected boolean doRemoveValue(Object value)
protected Object doRemoveValue(int index)
protected boolean doAddAll(Collection<? extends Object> c)
protected boolean doAddAll(int index,
Collection<? extends Object> c)
protected List<Array.Entry> doRemoveAll(Collection<?> c)
protected List<Array.Entry> doRetainAll(Collection<?> c)
protected void doClear()
protected EditableDocument editable(Document doc, int index)
protected EditableArray editable(List<?> array, int index)
protected EditableDocument createEditableDocument(MutableDocument document, int index, DocumentValueFactory factory)
protected EditableArray createEditableArray(MutableArray array, int index, DocumentValueFactory factory)
protected EditableArray createEditableSublist(MutableArray array, DocumentValueFactory factory)
public boolean isEmpty()
Documentpublic boolean contains(Object o)
public Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(Object e)
public boolean remove(Object o)
public boolean containsAll(Collection<?> c)
containsAll in interface Collection<Object>containsAll in interface List<Object>public boolean addAll(Collection<? extends Object> c)
public boolean addAll(int index,
Collection<? extends Object> c)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public void clear()
public int lastIndexOf(Object o)
lastIndexOf in interface List<Object>public Iterable<Array.Entry> getEntries()
ArraygetEntries in interface Arraypublic ListIterator<Object> listIterator()
listIterator in interface List<Object>public ListIterator<Object> listIterator(int index)
listIterator in interface List<Object>public EditableArray set(String name, Object value)
EditableArrayset in interface EditableArrayset in interface EditableDocumentname - The name of the fieldvalue - the new value for the fieldpublic EditableArray setBoolean(int index, boolean value)
EditableArraysetBoolean in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray setNumber(int index, int value)
EditableArraysetNumber in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray setNumber(int index, long value)
EditableArraysetNumber in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray setNumber(int index, float value)
EditableArraysetNumber in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray setNumber(int index, double value)
EditableArraysetNumber in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray setString(int index, String value)
EditableArraysetString in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray setSymbol(int index, String value)
EditableArraySymbol created from the supplied string value. Symbols are
defined in the BSON specification as being similar to a string but which exists for those languages that have a specific
symbol type. Symbols are serialized to JSON as a normal string.setSymbol in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldEditableArray.setString(int, String)public EditableDocument setDocument(int index)
EditableArraysetDocument in interface EditableArrayindex - The index in the array at which the value is to be setpublic EditableDocument setDocument(int index, Document document)
EditableArraysetDocument in interface EditableArrayindex - The index in the array at which the value is to be setdocument - the documentdocument.public EditableArray setArray(int index)
EditableArraysetArray in interface EditableArrayindex - The index in the array at which the value is to be setpublic EditableArray setArray(int index, Array array)
EditableArraysetArray in interface EditableArrayindex - The index in the array at which the value is to be setarray - the arrayarray.public EditableArray setDate(int index, Date value)
EditableArraysetDate in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray setDate(int index, String isoDate) throws ParseException
EditableArrayyyyy-MM-ddTHH:mm:ss" where "T" is a literal
characteryyyy-MM-ddTHH:mm:ssZ" where "T" and "
Z" are literal charactersyyyy-MM-ddTHH:mm:ssGMT+00:00" where "
T", and "GMT" are literal characterssetDate in interface EditableArrayindex - The index in the array at which the value is to be setisoDate - the new value for the fieldParseException - if the supplied value could not be parsed into a valid datepublic EditableArray setTimestamp(int index, int timeInSeconds, int increment)
EditableArrayTimestamp with the supplied time in seconds and increment. Note
that Date values are recommended for most purposes, as they are better suited to most applications' representations
of time instants.setTimestamp in interface EditableArrayindex - The index in the array at which the value is to be settimeInSeconds - the time in seconds for the new Timestampincrement - the time increment for the new TimestampEditableArray.setDate(int, Date)public EditableArray setObjectId(int index, String hex)
EditableArrayObjectId created from the supplied hexadecimal binary value.
Object IDs are defined by the BSON specification as 12-byte binary values designed to have a reasonably high probability of
being unique when allocated. Since there is no explicit way to represent these in a JSON document, each ObjectId value is
serialized in a JSON document as a nested document of the form:
{ "$oid" : "12bytesOfIdInBase16" }
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to an ObjectId value.
For example, an ObjectId with time value of "1310745823", machine value of "1", process value of "2", and increment value of "3" would be written as
{ "$oid" : "4e2064df0000010002000003" }
setObjectId in interface EditableArrayindex - The index in the array at which the value is to be sethex - the hexadecimal binary value for the ObjectIdEditableArray.setObjectId(int, byte[]),
EditableArray.setObjectId(int, int, int, int, int)public EditableArray setObjectId(int index, byte[] bytes)
EditableArrayObjectId created from the supplied 12-byte binary value.
Object IDs are defined by the BSON specification as 12-byte binary values designed to have a reasonably high probability of
being unique when allocated. Since there is no explicit way to represent these in a JSON document, each ObjectId value is
serialized in a JSON document as a nested document of the form:
{ "$oid" : "12bytesOfIdInBase16" }
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to an ObjectId value.
For example, an ObjectId with time value of "1310745823", machine value of "1", process value of "2", and increment value of "3" would be written as
{ "$oid" : "4e2064df0000010002000003" }
setObjectId in interface EditableArrayindex - The index in the array at which the value is to be setbytes - the 12-byte value for the ObjectIdEditableArray.setObjectId(int, String),
EditableArray.setObjectId(int, int, int, int, int)public EditableArray setObjectId(int index, int time, int machine, int process, int inc)
EditableArrayObjectId created from the supplied hexadecimal binary value.
Object IDs are defined by the BSON specification as 12-byte binary values designed to have a reasonably high probability of
being unique when allocated. Since there is no explicit way to represent these in a JSON document, each ObjectId value is
serialized in a JSON document as a nested document of the form:
{ "$oid" : "12bytesOfIdInBase16" }
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to an ObjectId value.
For example, an ObjectId with time value of "1310745823", machine value of "1", process value of "2", and increment value of "3" would be written as
{ "$oid" : "4e2064df0000010002000003" }
setObjectId in interface EditableArrayindex - The index in the array at which the value is to be settime - the Unix-style timestamp, which is a signed integer representing the number of seconds before or after January
1st 1970 (UTC)machine - the first three bytes of the (md5) hash of the machine host name, or of the mac/network address, or the
virtual machine idprocess - the 2 bytes of the process id (or thread id) of the process generating the object idinc - an ever incrementing value, or a random number if a counter can't be used in the language/runtimeEditableArray.setObjectId(int, String),
EditableArray.setObjectId(int, byte[])public EditableArray setRegularExpression(int index, String pattern)
EditableArrayPattern instances, and are stored natively in BSON as regular expressions. However,
when serialized to JSON, regular expressions are written as nested documents of the form:
{ "$regex" : "pattern" }
where "pattern" is the regular expression pattern.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to a regular expression value.
setRegularExpression in interface EditableArrayindex - The index in the array at which the value is to be setpattern - the regular expression pattern stringEditableArray.setRegularExpression(int, String, int)public EditableArray setRegularExpression(int index, String pattern, int flags)
EditableArrayPattern instances, and are stored natively in BSON as regular expressions. However,
when serialized to JSON, regular expressions are written as nested documents of the form:
{ "$regex" : "pattern", "$options" : "flags" }
where "pattern" is the regular expression pattern, and "flags" is a string representation of the regular
expression options.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to a regular expression value.
setRegularExpression in interface EditableArrayindex - The index in the array at which the value is to be setpattern - the regular expression pattern stringflags - the bitwise-anded Pattern options: Pattern.CANON_EQ, Pattern.CASE_INSENSITIVE,
Pattern.CASE_INSENSITIVE, Pattern.COMMENTS, Pattern.DOTALL, Pattern.LITERAL,
Pattern.MULTILINE, Pattern.UNICODE_CASE, and Pattern.UNIX_LINESEditableArray.setRegularExpression(int, String)public EditableArray setNull(int index)
EditableArrayNull is used for the value in the in-memory representation. The Document.isNull(String) methods can be used to
determine if a field has been set to null, or Document.isNullOrMissing(String) if the field has not be set or if it has
been set to null.setNull in interface EditableArrayindex - The index in the array at which the value is to be setDocument.isNull(String),
Document.isNullOrMissing(String)public EditableArray setBinary(int index, byte type, byte[] data)
EditableArray
{ "$type" : typeAsInt, "$base64" : "bytesInBase64" }
where "typeAsInt" is the integer representation of the BSON type, and "bytesInBase64" is
the Base64 encoding of the actual Binary bytes.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to Binary value.
setBinary in interface EditableArrayindex - The index in the array at which the value is to be settype - one of the BSON type constants denoting the type of the Binary valuedata - the bytes for the Binary valuepublic EditableArray setUuid(int index, UUID uuid)
EditableArrayUUID. JSON does not formally support binary values, and so
such values will be encoded using a nested document of the form:
{ "$uuid" : "string-form-of-uuid" }
where "string-form-of-uuid" is the UUID's string representation
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to UUID value.
setUuid in interface EditableArrayindex - The index in the array at which the value is to be setuuid - the UUID valuepublic EditableDocument setCode(int index, String code, boolean includeScope)
EditableArrayCode or CodeWithScope. JSON does not formally
support such values, and so when written to JSON they will be encoded using a nested document of the form:
{ "$code" : "code" }
or, if there is a scope document
{ "$code" : "code", "$scope" : scope document }
where "code" is the Code's JavaScript code and scopeDocument is the nested
document representing the scope in which the JavaScript code should be evaluated.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to Code or CodeWithScope value.
Note that when includeScope is true, the returned EditableArray can be used to populate
the scope document.
setCode in interface EditableArrayindex - The index in the array at which the value is to be setcode - the codeincludeScope - true if the code should include a scope (and if this method should return an EditableArray for
this scope document), or false otherwiseincludeScope is true, then the EditableDocument for the scope; otherwise, this
array to allow for chaining methodsEditableArray.setCode(int, String, Document)public EditableDocument setCode(int index, String code, Document scope)
EditableArrayCode or CodeWithScope. JSON does not formally
support such values, and so when written to JSON they will be encoded using a nested document of the form:
{ "$code" : "code" }
or, if there is a scope document
{ "$code" : "code", "$scope" : scope document }
where "code" is the Code's JavaScript code and scopeDocument is the nested
document representing the scope in which the JavaScript code should be evaluated.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to Code or CodeWithScope value.
setCode in interface EditableArrayindex - The index in the array at which the value is to be setcode - the codescope - the scope in which the JavaScript code should be evaulated, or null if there is no scopeEditableDocument for the scope; or this array if the scope is nullEditableArray.setCode(int, String, boolean)public EditableArray addBoolean(int index, boolean value)
EditableArrayaddBoolean in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray addNumber(int index, int value)
EditableArrayaddNumber in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray addNumber(int index, long value)
EditableArrayaddNumber in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray addNumber(int index, float value)
EditableArrayaddNumber in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray addNumber(int index, double value)
EditableArrayaddNumber in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray addString(int index, String value)
EditableArrayaddString in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray addSymbol(int index, String value)
EditableArraySymbol created from the supplied string value. Symbols are
defined in the BSON specification as being similar to a string but which exists for those languages that have a specific
symbol type. Symbols are serialized to JSON as a normal string.addSymbol in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldEditableArray.setString(int, String)public EditableDocument addDocument(int index)
EditableArrayaddDocument in interface EditableArrayindex - The index in the array at which the value is to be setpublic EditableDocument addDocument(int index, Document document)
EditableArrayaddDocument in interface EditableArrayindex - The index in the array at which the value is to be setdocument - the documentdocument.public EditableArray addArray(int index)
EditableArrayaddArray in interface EditableArrayindex - The index in the array at which the value is to be setpublic EditableArray addArray(int index, Array array)
EditableArrayaddArray in interface EditableArrayindex - The index in the array at which the value is to be setarray - the arrayarray.public EditableArray addDate(int index, Date value)
EditableArrayaddDate in interface EditableArrayindex - The index in the array at which the value is to be setvalue - the new value for the fieldpublic EditableArray addDate(int index, String isoDate) throws ParseException
EditableArrayyyyy-MM-ddTHH:mm:ss" where "T" is a literal
characteryyyy-MM-ddTHH:mm:ssZ" where "T" and "
Z" are literal charactersyyyy-MM-ddTHH:mm:ssGMT+00:00" where "
T", and "GMT" are literal charactersaddDate in interface EditableArrayindex - The index in the array at which the value is to be setisoDate - the new value for the fieldParseException - if the supplied value could not be parsed into a valid datepublic EditableArray addTimestamp(int index, int timeInSeconds, int increment)
EditableArrayTimestamp with the supplied time in seconds and increment.
Note that Date values are recommended for most purposes, as they are better suited to most applications'
representations of time instants.addTimestamp in interface EditableArrayindex - The index in the array at which the value is to be settimeInSeconds - the time in seconds for the new Timestampincrement - the time increment for the new TimestampEditableArray.setDate(int, Date)public EditableArray addObjectId(int index, String hex)
EditableArrayObjectId created from the supplied hexadecimal binary
value. Object IDs are defined by the BSON specification as 12-byte binary values designed to have a reasonably high
probability of being unique when allocated. Since there is no explicit way to represent these in a JSON document, each
ObjectId value is serialized in a JSON document as a nested document of the form:
{ "$oid" : "12bytesOfIdInBase16" }
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to an ObjectId value.
For example, an ObjectId with time value of "1310745823", machine value of "1", process value of "2", and increment value of "3" would be written as
{ "$oid" : "4e2064df0000010002000003" }
addObjectId in interface EditableArrayindex - The index in the array at which the value is to be sethex - the hexadecimal binary value for the ObjectIdEditableArray.setObjectId(int, byte[]),
EditableArray.setObjectId(int, int, int, int, int)public EditableArray addObjectId(int index, byte[] bytes)
EditableArrayObjectId created from the supplied 12-byte binary value.
Object IDs are defined by the BSON specification as 12-byte binary values designed to have a reasonably high probability of
being unique when allocated. Since there is no explicit way to represent these in a JSON document, each ObjectId value is
serialized in a JSON document as a nested document of the form:
{ "$oid" : "12bytesOfIdInBase16" }
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to an ObjectId value.
For example, an ObjectId with time value of "1310745823", machine value of "1", process value of "2", and increment value of "3" would be written as
{ "$oid" : "4e2064df0000010002000003" }
addObjectId in interface EditableArrayindex - The index in the array at which the value is to be setbytes - the 12-byte value for the ObjectIdEditableArray.setObjectId(int, String),
EditableArray.setObjectId(int, int, int, int, int)public EditableArray addObjectId(int index, int time, int machine, int process, int inc)
EditableArrayObjectId created from the supplied hexadecimal binary
value. Object IDs are defined by the BSON specification as 12-byte binary values designed to have a reasonably high
probability of being unique when allocated. Since there is no explicit way to represent these in a JSON document, each
ObjectId value is serialized in a JSON document as a nested document of the form:
{ "$oid" : "12bytesOfIdInBase16" }
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to an ObjectId value.
For example, an ObjectId with time value of "1310745823", machine value of "1", process value of "2", and increment value of "3" would be written as
{ "$oid" : "4e2064df0000010002000003" }
addObjectId in interface EditableArrayindex - The index in the array at which the value is to be settime - the Unix-style timestamp, which is a signed integer representing the number of seconds before or after January
1st 1970 (UTC)machine - the first three bytes of the (md5) hash of the machine host name, or of the mac/network address, or the
virtual machine idprocess - the 2 bytes of the process id (or thread id) of the process generating the object idinc - an ever incrementing value, or a random number if a counter can't be used in the language/runtimeEditableArray.setObjectId(int, String),
EditableArray.setObjectId(int, byte[])public EditableArray addRegularExpression(int index, String pattern)
EditableArrayPattern instances, and are stored natively in BSON as regular expressions. However,
when serialized to JSON, regular expressions are written as nested documents of the form:
{ "$regex" : "pattern" }
where "pattern" is the regular expression pattern.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to a regular expression value.
addRegularExpression in interface EditableArrayindex - The index in the array at which the value is to be setpattern - the regular expression pattern stringEditableArray.setRegularExpression(int, String, int)public EditableArray addRegularExpression(int index, String pattern, int flags)
EditableArrayPattern instances, and are stored natively in BSON as regular expressions. However,
when serialized to JSON, regular expressions are written as nested documents of the form:
{ "$regex" : "pattern", "$options" : "flags" }
where "pattern" is the regular expression pattern, and "flags" is a string representation of the regular
expression options.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to a regular expression value.
addRegularExpression in interface EditableArrayindex - The index in the array at which the value is to be setpattern - the regular expression pattern stringflags - the bitwise-anded Pattern options: Pattern.CANON_EQ, Pattern.CASE_INSENSITIVE,
Pattern.CASE_INSENSITIVE, Pattern.COMMENTS, Pattern.DOTALL, Pattern.LITERAL,
Pattern.MULTILINE, Pattern.UNICODE_CASE, and Pattern.UNIX_LINESEditableArray.setRegularExpression(int, String)public EditableArray addNull(int index)
EditableArrayNull is used for the value in the in-memory representation. The Document.isNull(String) methods can be used to
determine if a field has been set to null, or Document.isNullOrMissing(String) if the field has not be set or if it has
been set to null.addNull in interface EditableArrayindex - The index in the array at which the value is to be setDocument.isNull(String),
Document.isNullOrMissing(String)public EditableArray addBinary(int index, byte type, byte[] data)
EditableArray
{ "$type" : typeAsInt, "$base64" : "bytesInBase64" }
where "typeAsInt" is the integer representation of the BSON type, and "bytesInBase64" is
the Base64 encoding of the actual Binary bytes.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to Binary value.
addBinary in interface EditableArrayindex - The index in the array at which the value is to be settype - one of the BSON type constants denoting the type of the Binary valuedata - the bytes for the Binary valuepublic EditableArray addUuid(int index, UUID uuid)
EditableArrayUUID. JSON does not formally support binary values, and
so such values will be encoded using a nested document of the form:
{ "$uuid" : "string-form-of-uuid" }
where "string-form-of-uuid" is the UUID's string representation
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to UUID value.
addUuid in interface EditableArrayindex - The index in the array at which the value is to be setuuid - the UUID valuepublic EditableDocument addCode(int index, String code, boolean includeScope)
EditableArrayCode or CodeWithScope. JSON does not formally
support such values, and so when written to JSON they will be encoded using a nested document of the form:
{ "$code" : "code" }
or, if there is a scope document
{ "$code" : "code", "$scope" : scope document }
where "code" is the Code's JavaScript code and scopeDocument is the nested
document representing the scope in which the JavaScript code should be evaluated.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to Code or CodeWithScope value.
Note that when includeScope is true, the returned EditableArray can be used to populate
the scope document.
addCode in interface EditableArrayindex - The index in the array at which the value is to be setcode - the codeincludeScope - true if the code should include a scope (and if this method should return an EditableArray for
this scope document), or false otherwiseincludeScope is true, then the EditableDocument for the scope; otherwise, this
array to allow for chaining methodsEditableArray.setCode(int, String, Document)public EditableDocument addCode(int index, String code, Document scope)
EditableArrayCode or CodeWithScope. JSON does not formally
support such values, and so when written to JSON they will be encoded using a nested document of the form:
{ "$code" : "code" }
or, if there is a scope document
{ "$code" : "code", "$scope" : scope document }
where "code" is the Code's JavaScript code and scopeDocument is the nested
document representing the scope in which the JavaScript code should be evaluated.
When nested documents of this form are read by this library's JSON reader, nested documents of this form will
be converted to Code or CodeWithScope value.
addCode in interface EditableArrayindex - The index in the array at which the value is to be setcode - the codescope - the scope in which the JavaScript code should be evaulated, or null if there is no scopeEditableDocument for the scope; or this array if the scope is nullEditableArray.setCode(int, String, boolean)public EditableArray addBoolean(boolean value)
EditableArrayaddBoolean in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addNumber(int value)
EditableArrayaddNumber in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addNumber(long value)
EditableArrayaddNumber in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addNumber(float value)
EditableArrayaddNumber in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addNumber(double value)
EditableArrayaddNumber in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addString(String value)
EditableArrayaddString in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addSymbol(String value)
EditableArrayaddSymbol in interface EditableArrayvalue - the new value for the fieldEditableArray.addString(String)public EditableDocument addDocument()
EditableArrayaddDocument in interface EditableArraypublic EditableDocument addDocument(Document document)
EditableArrayaddDocument in interface EditableArraydocument - the documentdocument.public EditableArray addArray()
EditableArrayaddArray in interface EditableArraypublic EditableArray addArray(Array array)
EditableArrayaddArray in interface EditableArrayarray - the arrayarray.public EditableArray addDate(Date value)
EditableArrayaddDate in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addDate(String isoDate) throws ParseException
EditableArrayaddDate in interface EditableArrayisoDate - the new value for the fieldParseException - if the supplied value could not be parsed into a valid dateEditableArray.addDate(Date)public EditableArray addTimestamp(int timeInSeconds, int increment)
EditableArrayaddTimestamp in interface EditableArraytimeInSeconds - the time in seconds for the new Timestampincrement - the time increment for the new TimestampEditableArray.addDate(Date)public EditableArray addObjectId(String hex)
EditableArrayaddObjectId in interface EditableArrayhex - the hexadecimal binary value for the ObjectIdEditableArray.addObjectId(byte[]),
EditableArray.addObjectId(int, int, int, int)public EditableArray addObjectId(byte[] bytes)
EditableArrayaddObjectId in interface EditableArraybytes - the 12-byte value for the ObjectIdEditableArray.addObjectId(String),
EditableArray.addObjectId(int, int, int, int)public EditableArray addObjectId(int time, int machine, int process, int inc)
EditableArrayaddObjectId in interface EditableArraytime - the Unix-style timestamp, which is a signed integer representing the number of seconds before or after January
1st 1970 (UTC)machine - the first three bytes of the (md5) hash of the machine host name, or of the mac/network address, or the
virtual machine idprocess - the 2 bytes of the process id (or thread id) of the process generating the object idinc - an ever incrementing value, or a random number if a counter can't be used in the language/runtimeEditableArray.addObjectId(String),
EditableArray.addObjectId(byte[])public EditableArray addRegularExpression(String pattern)
EditableArrayaddRegularExpression in interface EditableArraypattern - the regular expression pattern stringpublic EditableArray addRegularExpression(String pattern, int flags)
EditableArrayaddRegularExpression in interface EditableArraypattern - the regular expression pattern stringflags - the bitwise-anded Pattern options: Pattern.CANON_EQ, Pattern.CASE_INSENSITIVE,
Pattern.CASE_INSENSITIVE, Pattern.COMMENTS, Pattern.DOTALL, Pattern.LITERAL,
Pattern.MULTILINE, Pattern.UNICODE_CASE, and Pattern.UNIX_LINESpublic EditableArray addNull()
EditableArrayNull value.addNull in interface EditableArrayDocument.isNull(String),
Document.isNullOrMissing(String)public EditableArray addBinary(byte type, byte[] data)
EditableArrayBinary value with the supplied type and content.addBinary in interface EditableArraytype - one of the BSON type constants denoting the type of the Binary valuedata - the bytes for the Binary valuepublic EditableArray addUuid(UUID uuid)
EditableArrayaddUuid in interface EditableArrayuuid - the UUID valuepublic EditableDocument addCode(String code, boolean includeScope)
EditableArrayCode with the supplied JavaScript code.addCode in interface EditableArraycode - the codeincludeScope - true if the code should include a scope (and if this method should return an EditableArray for
this scope document), or false otherwiseincludeScope is true, then the EditableArray for the scope; otherwise, this
document to allow for chaining methodsEditableArray.addCode(String, Document)public EditableDocument addCode(String code, Document scope)
EditableArrayCodeWithScope with the supplied JavaScript code and scope.addCode in interface EditableArraycode - the codescope - the scope in which the JavaScript code should be evaulated, or null if there is no scopeEditableDocument for the scope, or null if the scope reference is nullEditableArray.addCode(String, boolean)public EditableArray addBooleanIfAbsent(boolean value)
EditableArrayaddBooleanIfAbsent in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addNumberIfAbsent(int value)
EditableArrayaddNumberIfAbsent in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addNumberIfAbsent(long value)
EditableArrayaddNumberIfAbsent in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addNumberIfAbsent(float value)
EditableArrayaddNumberIfAbsent in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addNumberIfAbsent(double value)
EditableArrayaddNumberIfAbsent in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addStringIfAbsent(String value)
EditableArrayaddStringIfAbsent in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addSymbolIfAbsent(String value)
EditableArrayaddSymbolIfAbsent in interface EditableArrayvalue - the new value for the fieldEditableArray.addString(String)public EditableDocument addDocumentIfAbsent(Document document)
EditableArrayaddDocumentIfAbsent in interface EditableArraydocument - the documentdocument.public EditableArray addArrayIfAbsent(Array array)
EditableArrayaddArrayIfAbsent in interface EditableArrayarray - the arrayarray.public EditableArray addDateIfAbsent(Date value)
EditableArrayaddDateIfAbsent in interface EditableArrayvalue - the new value for the fieldpublic EditableArray addDateIfAbsent(String isoDate) throws ParseException
EditableArrayaddDateIfAbsent in interface EditableArrayisoDate - the new value for the fieldParseException - if the supplied value could not be parsed into a valid dateEditableArray.addDate(Date)public EditableArray addTimestampIfAbsent(int timeInSeconds, int increment)
EditableArrayaddTimestampIfAbsent in interface EditableArraytimeInSeconds - the time in seconds for the new Timestampincrement - the time increment for the new TimestampEditableArray.addDate(Date)public EditableArray addObjectIdIfAbsent(String hex)
EditableArrayaddObjectIdIfAbsent in interface EditableArrayhex - the hexadecimal binary value for the ObjectIdEditableArray.addObjectId(byte[]),
EditableArray.addObjectId(int, int, int, int)public EditableArray addObjectIdIfAbsent(byte[] bytes)
EditableArrayaddObjectIdIfAbsent in interface EditableArraybytes - the 12-byte value for the ObjectIdEditableArray.addObjectId(String),
EditableArray.addObjectId(int, int, int, int)public EditableArray addObjectIdIfAbsent(int time, int machine, int process, int inc)
EditableArrayaddObjectIdIfAbsent in interface EditableArraytime - the Unix-style timestamp, which is a signed integer representing the number of seconds before or after January
1st 1970 (UTC)machine - the first three bytes of the (md5) hash of the machine host name, or of the mac/network address, or the
virtual machine idprocess - the 2 bytes of the process id (or thread id) of the process generating the object idinc - an ever incrementing value, or a random number if a counter can't be used in the language/runtimeEditableArray.addObjectId(String),
EditableArray.addObjectId(byte[])public EditableArray addRegularExpressionIfAbsent(String pattern)
EditableArrayaddRegularExpressionIfAbsent in interface EditableArraypattern - the regular expression pattern stringpublic EditableArray addRegularExpressionIfAbsent(String pattern, int flags)
EditableArrayaddRegularExpressionIfAbsent in interface EditableArraypattern - the regular expression pattern stringflags - the bitwise-anded Pattern options: Pattern.CANON_EQ, Pattern.CASE_INSENSITIVE,
Pattern.CASE_INSENSITIVE, Pattern.COMMENTS, Pattern.DOTALL, Pattern.LITERAL,
Pattern.MULTILINE, Pattern.UNICODE_CASE, and Pattern.UNIX_LINESpublic EditableArray addNullIfAbsent()
EditableArrayNull value, if and only if there is not already a null value in the array.addNullIfAbsent in interface EditableArrayDocument.isNull(String),
Document.isNullOrMissing(String)public EditableArray addBinaryIfAbsent(byte type, byte[] data)
EditableArrayBinary value with the supplied type and content, if and only if an equivalent value doesn't
already exist in the array.addBinaryIfAbsent in interface EditableArraytype - one of the BSON type constants denoting the type of the Binary valuedata - the bytes for the Binary valuepublic EditableArray addUuidIfAbsent(UUID uuid)
EditableArrayaddUuidIfAbsent in interface EditableArrayuuid - the UUID valuepublic EditableDocument addCodeIfAbsent(String code, Document scope)
EditableArrayCodeWithScope with the supplied JavaScript code and scope, if and only if an equivalent value
doesn't already exist in the array.addCodeIfAbsent in interface EditableArraycode - the codescope - the scope in which the JavaScript code should be evaulated, or null if there is no scopeEditableDocument for the scope, or null if the scope reference is nullEditableArray.addCode(String, boolean)Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.