|
ModeShape Distribution 3.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.infinispan.schematic.internal.document.ArrayEditor
public class ArrayEditor
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.infinispan.schematic.document.Array |
---|
Array.Entry |
Nested classes/interfaces inherited from interface org.infinispan.schematic.document.Document |
---|
Document.Field, Document.ValueTransformer |
Constructor Summary | |
---|---|
ArrayEditor(MutableArray array,
DocumentValueFactory factory)
|
Method Summary | ||
---|---|---|
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.Field s 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)
|
|
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()
|
|
|
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. |
|
static Array |
unwrap(Array array)
|
|
static Document |
unwrap(Document document)
|
|
static Object |
unwrap(Object value)
|
|
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 |
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. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
equals, hashCode |
Constructor Detail |
---|
public ArrayEditor(MutableArray array, DocumentValueFactory factory)
Method Detail |
---|
public ArrayEditor clone()
Document
clone
in interface Array
clone
in interface Document
clone
in class Object
public ArrayEditor with(Map<String,Object> changedFields)
Document
with
in interface Document
changedFields
- the fields that should be changed; may be null
public ArrayEditor with(Document.ValueTransformer transformer)
Document
Document.ValueTransformer
.
with
in interface Document
transformer
- the transformer that should be used to transform each field value; may not be null
public Document withVariablesReplaced(Properties properties)
Document
Variables 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 exceptNote 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 Document
properties
- the properties keyed by variable name
Document.withVariablesReplacedWithSystemProperties()
,
Document.with(ValueTransformer)
,
SchemaLibrary.convertValues(Document, String)
public Document withVariablesReplacedWithSystemProperties()
Document
Variables 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 exceptNote 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 Document
Document.withVariablesReplaced(Properties)
,
Document.with(ValueTransformer)
,
SchemaLibrary.convertValues(Document, String)
public Array unwrap()
EditableDocument
unwrap
in interface EditableDocument
public MutableArray asMutableArray()
public Object get(String name)
Document
get
in interface Document
name
- The name of the pair
public Boolean getBoolean(String name)
Document
getBoolean
in interface Document
name
- The name of the pair
public boolean getBoolean(String name, boolean defaultValue)
Document
getBoolean
in interface Document
name
- The name of the pairdefaultValue
- the default value to return if there is no such pair or if the value is not a boolean
defaultValue
if there is no such pair or if the value is not a
booleanpublic Object put(String name, Object value)
public void putAll(Document object)
EditableDocument
putAll
in interface EditableDocument
object
- the object containing the name/value pairs to be set on this objectpublic void putAll(Map<? extends String,? extends Object> map)
EditableDocument
putAll
in interface EditableDocument
map
- the map containing the name/value pairs to be set on this objectpublic Object remove(String name)
EditableDocument
remove
in interface EditableDocument
name
- The name of the field
public Integer getInteger(String name)
Document
getInteger
in interface Document
name
- The name of the pair
public int getInteger(String name, int defaultValue)
Document
getInteger
in interface Document
name
- The name of the pairdefaultValue
- the default value to return if there is no such pair or if the value is not a integer
defaultValue
if there is no such pair or if the value is not a
integerpublic Long getLong(String name)
Document
getLong
in interface Document
name
- The name of the pair
public long getLong(String name, long defaultValue)
Document
getLong
in interface Document
name
- The name of the pairdefaultValue
- the default value to return if there is no such pair or if the value is not a long value
defaultValue
if there is no such pair or if the value is not a long
valuepublic Double getDouble(String name)
Document
getDouble
in interface Document
name
- The name of the pair
public double getDouble(String name, double defaultValue)
Document
getDouble
in interface Document
name
- The name of the pairdefaultValue
- the default value to return if there is no such pair or if the value is not a double
defaultValue
if there is no such pair or if the value is not a
doublepublic Number getNumber(String name)
Document
getNumber
in interface Document
name
- The name of the pair
public Number getNumber(String name, Number defaultValue)
Document
getNumber
in interface Document
name
- The name of the pairdefaultValue
- the default value to return if there is no such pair or if the value is not a number
defaultValue
if there is no such pair or if the value is not a
numberpublic String getString(String name)
Document
Symbol
.
getString
in interface Document
name
- The name of the pair
public String getString(String name, String defaultValue)
Document
Symbol
.
getString
in interface Document
name
- The name of the pairdefaultValue
- the default value to return if there is no such pair or if the value is not a string
defaultValue
if there is no such pair or if the value is not a
stringpublic EditableArray getArray(String name)
EditableArray
getArray
in interface Document
getArray
in interface EditableArray
getArray
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the array
public EditableArray getOrCreateArray(String name)
EditableDocument
getOrCreateArray
in interface EditableDocument
name
- The name of the pair
public EditableDocument getDocument(String name)
EditableArray
getDocument
in interface Document
getDocument
in interface EditableArray
getDocument
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the array
public EditableDocument getOrCreateDocument(String name)
EditableDocument
getOrCreateDocument
in interface EditableDocument
name
- The name of the pair
public boolean isNull(String name)
Document
this.get(name) instanceof Null;
isNull
in interface Document
name
- The name of the pair
true
if the field has been set to a Null
value, or false otherwiseDocument.isNullOrMissing(String)
public boolean isNullOrMissing(String name)
Document
Null.matches(this.get(name));
isNullOrMissing
in interface Document
name
- The name of the pair
true
if the field value for the name is null or if there is no such field.Document.isNull(String)
public MaxKey getMaxKey(String name)
Document
MaxKey
value in this document for the given field name.
getMaxKey
in interface Document
name
- The name of the pair
MaxKey
field value, if found, or null if there is no such pair or if the value is not a MaxKey
public MinKey getMinKey(String name)
Document
MinKey
value in this document for the given field name.
getMinKey
in interface Document
name
- The name of the pair
MinKey
field value, if found, or null if there is no such pair or if the value is not a MinKey
public Code getCode(String name)
Document
Code
value in this document for the given field name.
getCode
in interface Document
name
- The name of the pair
Code
field value, if found, or null if there is no such pair or if the value is not a Code
public CodeWithScope getCodeWithScope(String name)
Document
CodeWithScope
value in this document for the given field name.
getCodeWithScope
in interface Document
name
- The name of the pair
CodeWithScope
field value, if found, or null if there is no such pair or if the value is not a
CodeWithScope
public ObjectId getObjectId(String name)
Document
ObjectId
value in this document for the given field name.
getObjectId
in interface Document
name
- The name of the pair
ObjectId
field value, if found, or null if there is no such pair or if the value is not a
ObjectId
public Binary getBinary(String name)
Document
Binary
value in this document for the given field name.
getBinary
in interface Document
name
- The name of the pair
Binary
field value, if found, or null if there is no such pair or if the value is not a Binary
public Symbol getSymbol(String name)
Document
Symbol
value in this document for the given field name.
getSymbol
in interface Document
name
- The name of the pair
Symbol
field value, if found, or null if there is no such pair or if the value is not a Symbol
public Pattern getPattern(String name)
Document
Pattern
value in this document for the given field name.
getPattern
in interface Document
name
- The name of the pair
Pattern
field value, if found, or null if there is no such pair or if the value is not a
Pattern
public UUID getUuid(String name)
Document
UUID
value in this document for the given field name.
getUuid
in interface Document
name
- The name of the pair
UUID
field value, if found, or null if there is no such pair or if the value is not a UUID
public UUID getUuid(String name, UUID defaultValue)
Document
UUID
value in this document for the given field name.
getUuid
in interface Document
name
- The name of the pairdefaultValue
- the default value to return if there is no such pair or if the value is not a string
UUID
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)
Document
Bson.Type
constant that describes the type of value for the given field name.
getType
in interface Document
name
- The name of the pair
Bson.Type
constant describing the value, or -1 if there is no field with the supplied namepublic Map<String,? extends Object> toMap()
Document
toMap
in interface Document
public Iterable<Document.Field> fields()
Document
Document.Field
s in this object.
fields
in interface Document
public boolean containsField(String name)
Document
containsField
in interface Document
name
- The name of the pair for which to check
public boolean containsAll(Document document)
Document
containsAll
in interface Document
document
- The document with the fields that should be in this document
public Set<String> keySet()
Document
keySet
in interface Document
public int size()
Document
size
in interface Collection<Object>
size
in interface List<Object>
size
in interface Document
public void removeAll()
EditableDocument
removeAll
in interface EditableDocument
public EditableArray setBoolean(String name, boolean value)
EditableArray
setBoolean
in interface EditableArray
setBoolean
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arrayvalue
- the new value for the field
public EditableArray setNumber(String name, int value)
EditableArray
setNumber
in interface EditableArray
setNumber
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arrayvalue
- the new value for the field
public EditableArray setNumber(String name, long value)
EditableArray
setNumber
in interface EditableArray
setNumber
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arrayvalue
- the new value for the field
public EditableArray setNumber(String name, float value)
EditableArray
setNumber
in interface EditableArray
setNumber
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arrayvalue
- the new value for the field
public EditableArray setNumber(String name, double value)
EditableArray
setNumber
in interface EditableArray
setNumber
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arrayvalue
- the new value for the field
public EditableArray setString(String name, String value)
EditableArray
setString
in interface EditableArray
setString
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arrayvalue
- the new value for the field
public EditableArray setSymbol(String name, String value)
EditableArray
Symbol
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 EditableArray
setSymbol
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arrayvalue
- the new value for the field
EditableArray.setString(String, String)
public EditableDocument setDocument(String name)
EditableArray
setDocument
in interface EditableArray
setDocument
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the array
public EditableDocument setDocument(String name, Document document)
EditableArray
setDocument
in interface EditableArray
setDocument
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arraydocument
- the document
document
.public EditableArray setArray(String name)
EditableArray
setArray
in interface EditableArray
setArray
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the array
public EditableArray setArray(String name, Array array)
EditableArray
setArray
in interface EditableArray
setArray
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arrayarray
- the array
array
.public EditableArray setArray(String name, Object... values)
EditableDocument
setArray
in interface EditableDocument
name
- The name of the fieldvalues
- the (valid) values for the array
array
.public EditableArray setDate(String name, Date value)
EditableArray
setDate
in interface EditableArray
setDate
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arrayvalue
- the new value for the field
public EditableArray setDate(String name, String isoDate) throws ParseException
EditableArray
yyyy-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 characters
setDate
in interface EditableArray
setDate
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arrayisoDate
- the new value for the field
ParseException
- if the supplied value could not be parsed into a valid datepublic EditableArray setTimestamp(String name, int timeInSeconds, int increment)
EditableArray
Timestamp
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 EditableArray
setTimestamp
in interface EditableDocument
name
- 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 Timestamp
EditableArray.setDate(String, Date)
public EditableArray setObjectId(String name, String hex)
EditableArray
ObjectId
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 EditableArray
setObjectId
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arrayhex
- the hexadecimal binary value for the ObjectId
EditableArray.setObjectId(String, byte[])
,
EditableArray.setObjectId(String, int, int, int, int)
public EditableArray setObjectId(String name, byte[] bytes)
EditableArray
ObjectId
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 EditableArray
setObjectId
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arraybytes
- the 12-byte value for the ObjectId
EditableArray.setObjectId(String, String)
,
EditableArray.setObjectId(String, int, int, int, int)
public EditableArray setObjectId(String name, int time, int machine, int process, int inc)
EditableArray
ObjectId
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 EditableArray
setObjectId
in interface EditableDocument
name
- 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/runtime
EditableArray.setObjectId(String, String)
,
EditableArray.setObjectId(String, byte[])
public EditableArray setRegularExpression(String name, String pattern)
EditableArray
Pattern
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 EditableArray
setRegularExpression
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arraypattern
- the regular expression pattern string
EditableArray.setRegularExpression(String, String, int)
public EditableArray setRegularExpression(String name, String pattern, int flags)
EditableArray
Pattern
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 EditableArray
setRegularExpression
in interface EditableDocument
name
- 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_LINES
EditableArray.setRegularExpression(String, String)
public EditableArray setNull(String name)
EditableArray
Null
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 EditableArray
setNull
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the array
Document.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 EditableArray
setBinary
in interface EditableDocument
name
- 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
value
public EditableArray setUuid(String name, UUID uuid)
EditableArray
UUID
. 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 EditableArray
setUuid
in interface EditableDocument
name
- The name of the field, which is the string representation of the index in the arrayuuid
- the UUID value
public EditableDocument setCode(String name, String code, boolean includeScope)
EditableArray
Code
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 EditableArray
setCode
in interface EditableDocument
name
- 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 otherwise
includeScope
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)
EditableArray
Code
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 EditableArray
setCode
in interface EditableDocument
name
- 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 scope
EditableDocument
for the scopeEditableArray.setCode(String, String, boolean)
protected EditableArray setValue(String name, Object value)
public EditableArray setValue(int index, Object value)
EditableArray
setValue
in interface EditableArray
index
- The index in the arrayvalue
- the new value
public EditableArray addValue(Object value)
EditableArray
addValue
in interface EditableArray
value
- the new value
public EditableArray addValueIfAbsent(Object value)
EditableArray
addValueIfAbsent
in interface EditableArray
value
- the value
public EditableArray addValue(int index, Object value)
EditableArray
addValue
in interface EditableArray
index
- The index in the arrayvalue
- the new value
protected final int indexFrom(String name)
protected Object doSetValue(String name, Object value)
protected Object doSetValue(int index, Object value)
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 static Array unwrap(Array array)
public static Document unwrap(Document document)
public static Object unwrap(Object value)
public boolean isEmpty()
Document
isEmpty
in interface Collection<Object>
isEmpty
in interface List<Object>
isEmpty
in interface Document
public boolean contains(Object o)
contains
in interface Collection<Object>
contains
in interface List<Object>
public Iterator<Object> iterator()
iterator
in interface Iterable<Object>
iterator
in interface Collection<Object>
iterator
in interface List<Object>
public Object[] toArray()
toArray
in interface Collection<Object>
toArray
in interface List<Object>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<Object>
toArray
in interface List<Object>
public boolean add(Object e)
add
in interface Collection<Object>
add
in interface List<Object>
public boolean remove(Object o)
remove
in interface Collection<Object>
remove
in interface List<Object>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<Object>
containsAll
in interface List<Object>
public boolean addAll(Collection<? extends Object> c)
addAll
in interface Collection<Object>
addAll
in interface List<Object>
public boolean addAll(int index, Collection<? extends Object> c)
addAll
in interface List<Object>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<Object>
removeAll
in interface List<Object>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<Object>
retainAll
in interface List<Object>
public void clear()
clear
in interface Collection<Object>
clear
in interface List<Object>
public Object get(int index)
get
in interface List<Object>
public Object set(int index, Object element)
set
in interface List<Object>
public void add(int index, Object element)
add
in interface List<Object>
public Object remove(int index)
remove
in interface List<Object>
public int indexOf(Object o)
indexOf
in interface List<Object>
public int lastIndexOf(Object o)
lastIndexOf
in interface List<Object>
public Iterable<Array.Entry> getEntries()
Array
getEntries
in interface Array
public ListIterator<Object> listIterator()
listIterator
in interface List<Object>
public ListIterator<Object> listIterator(int index)
listIterator
in interface List<Object>
public List<Object> subList(int fromIndex, int toIndex)
subList
in interface List<Object>
public EditableArray set(String name, Object value)
EditableArray
set
in interface EditableArray
set
in interface EditableDocument
name
- The name of the fieldvalue
- the new value for the field
public EditableArray setBoolean(int index, boolean value)
EditableArray
setBoolean
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray setNumber(int index, int value)
EditableArray
setNumber
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray setNumber(int index, long value)
EditableArray
setNumber
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray setNumber(int index, float value)
EditableArray
setNumber
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray setNumber(int index, double value)
EditableArray
setNumber
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray setString(int index, String value)
EditableArray
setString
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray setSymbol(int index, String value)
EditableArray
Symbol
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 EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
EditableArray.setString(int, String)
public EditableDocument setDocument(int index)
EditableArray
setDocument
in interface EditableArray
index
- The index in the array at which the value is to be set
public EditableDocument setDocument(int index, Document document)
EditableArray
setDocument
in interface EditableArray
index
- The index in the array at which the value is to be setdocument
- the document
document
.public EditableArray setArray(int index)
EditableArray
setArray
in interface EditableArray
index
- The index in the array at which the value is to be set
public EditableArray setArray(int index, Array array)
EditableArray
setArray
in interface EditableArray
index
- The index in the array at which the value is to be setarray
- the array
array
.public EditableArray setDate(int index, Date value)
EditableArray
setDate
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray setDate(int index, String isoDate) throws ParseException
EditableArray
yyyy-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 characters
setDate
in interface EditableArray
index
- The index in the array at which the value is to be setisoDate
- the new value for the field
ParseException
- if the supplied value could not be parsed into a valid datepublic EditableArray setTimestamp(int index, int timeInSeconds, int increment)
EditableArray
Timestamp
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 EditableArray
index
- 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 Timestamp
EditableArray.setDate(int, Date)
public EditableArray setObjectId(int index, String hex)
EditableArray
ObjectId
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 EditableArray
index
- The index in the array at which the value is to be sethex
- the hexadecimal binary value for the ObjectId
EditableArray.setObjectId(int, byte[])
,
EditableArray.setObjectId(int, int, int, int, int)
public EditableArray setObjectId(int index, byte[] bytes)
EditableArray
ObjectId
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 EditableArray
index
- The index in the array at which the value is to be setbytes
- the 12-byte value for the ObjectId
EditableArray.setObjectId(int, String)
,
EditableArray.setObjectId(int, int, int, int, int)
public EditableArray setObjectId(int index, int time, int machine, int process, int inc)
EditableArray
ObjectId
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 EditableArray
index
- 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/runtime
EditableArray.setObjectId(int, String)
,
EditableArray.setObjectId(int, byte[])
public EditableArray setRegularExpression(int index, String pattern)
EditableArray
Pattern
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 EditableArray
index
- The index in the array at which the value is to be setpattern
- the regular expression pattern string
EditableArray.setRegularExpression(int, String, int)
public EditableArray setRegularExpression(int index, String pattern, int flags)
EditableArray
Pattern
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 EditableArray
index
- 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_LINES
EditableArray.setRegularExpression(int, String)
public EditableArray setNull(int index)
EditableArray
Null
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 EditableArray
index
- The index in the array at which the value is to be set
Document.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 EditableArray
index
- 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
value
public EditableArray setUuid(int index, UUID uuid)
EditableArray
UUID
. 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 EditableArray
index
- The index in the array at which the value is to be setuuid
- the UUID value
public EditableDocument setCode(int index, String code, boolean includeScope)
EditableArray
Code
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 EditableArray
index
- 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 otherwise
includeScope
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)
EditableArray
Code
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 EditableArray
index
- 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 scope
EditableDocument
for the scope; or this array if the scope is nullEditableArray.setCode(int, String, boolean)
public EditableArray addBoolean(int index, boolean value)
EditableArray
addBoolean
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray addNumber(int index, int value)
EditableArray
addNumber
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray addNumber(int index, long value)
EditableArray
addNumber
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray addNumber(int index, float value)
EditableArray
addNumber
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray addNumber(int index, double value)
EditableArray
addNumber
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray addString(int index, String value)
EditableArray
addString
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray addSymbol(int index, String value)
EditableArray
Symbol
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 EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
EditableArray.setString(int, String)
public EditableDocument addDocument(int index)
EditableArray
addDocument
in interface EditableArray
index
- The index in the array at which the value is to be set
public EditableDocument addDocument(int index, Document document)
EditableArray
addDocument
in interface EditableArray
index
- The index in the array at which the value is to be setdocument
- the document
document
.public EditableArray addArray(int index)
EditableArray
addArray
in interface EditableArray
index
- The index in the array at which the value is to be set
public EditableArray addArray(int index, Array array)
EditableArray
addArray
in interface EditableArray
index
- The index in the array at which the value is to be setarray
- the array
array
.public EditableArray addDate(int index, Date value)
EditableArray
addDate
in interface EditableArray
index
- The index in the array at which the value is to be setvalue
- the new value for the field
public EditableArray addDate(int index, String isoDate) throws ParseException
EditableArray
yyyy-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 characters
addDate
in interface EditableArray
index
- The index in the array at which the value is to be setisoDate
- the new value for the field
ParseException
- if the supplied value could not be parsed into a valid datepublic EditableArray addTimestamp(int index, int timeInSeconds, int increment)
EditableArray
Timestamp
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 EditableArray
index
- 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 Timestamp
EditableArray.setDate(int, Date)
public EditableArray addObjectId(int index, String hex)
EditableArray
ObjectId
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 EditableArray
index
- The index in the array at which the value is to be sethex
- the hexadecimal binary value for the ObjectId
EditableArray.setObjectId(int, byte[])
,
EditableArray.setObjectId(int, int, int, int, int)
public EditableArray addObjectId(int index, byte[] bytes)
EditableArray
ObjectId
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 EditableArray
index
- The index in the array at which the value is to be setbytes
- the 12-byte value for the ObjectId
EditableArray.setObjectId(int, String)
,
EditableArray.setObjectId(int, int, int, int, int)
public EditableArray addObjectId(int index, int time, int machine, int process, int inc)
EditableArray
ObjectId
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 EditableArray
index
- 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/runtime
EditableArray.setObjectId(int, String)
,
EditableArray.setObjectId(int, byte[])
public EditableArray addRegularExpression(int index, String pattern)
EditableArray
Pattern
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 EditableArray
index
- The index in the array at which the value is to be setpattern
- the regular expression pattern string
EditableArray.setRegularExpression(int, String, int)
public EditableArray addRegularExpression(int index, String pattern, int flags)
EditableArray
Pattern
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 EditableArray
index
- 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_LINES
EditableArray.setRegularExpression(int, String)
public EditableArray addNull(int index)
EditableArray
Null
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 EditableArray
index
- The index in the array at which the value is to be set
Document.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 EditableArray
index
- 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
value
public EditableArray addUuid(int index, UUID uuid)
EditableArray
UUID
. 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 EditableArray
index
- The index in the array at which the value is to be setuuid
- the UUID value
public EditableDocument addCode(int index, String code, boolean includeScope)
EditableArray
Code
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 EditableArray
index
- 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 otherwise
includeScope
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)
EditableArray
Code
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 EditableArray
index
- 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 scope
EditableDocument
for the scope; or this array if the scope is nullEditableArray.setCode(int, String, boolean)
public EditableArray addBoolean(boolean value)
EditableArray
addBoolean
in interface EditableArray
value
- the new value for the field
public EditableArray addNumber(int value)
EditableArray
addNumber
in interface EditableArray
value
- the new value for the field
public EditableArray addNumber(long value)
EditableArray
addNumber
in interface EditableArray
value
- the new value for the field
public EditableArray addNumber(float value)
EditableArray
addNumber
in interface EditableArray
value
- the new value for the field
public EditableArray addNumber(double value)
EditableArray
addNumber
in interface EditableArray
value
- the new value for the field
public EditableArray addString(String value)
EditableArray
addString
in interface EditableArray
value
- the new value for the field
public EditableArray addSymbol(String value)
EditableArray
addSymbol
in interface EditableArray
value
- the new value for the field
EditableArray.addString(String)
public EditableDocument addDocument()
EditableArray
addDocument
in interface EditableArray
public EditableDocument addDocument(Document document)
EditableArray
addDocument
in interface EditableArray
document
- the document
document
.public EditableArray addArray()
EditableArray
addArray
in interface EditableArray
public EditableArray addArray(Array array)
EditableArray
addArray
in interface EditableArray
array
- the array
array
.public EditableArray addDate(Date value)
EditableArray
addDate
in interface EditableArray
value
- the new value for the field
public EditableArray addDate(String isoDate) throws ParseException
EditableArray
addDate
in interface EditableArray
isoDate
- the new value for the field
ParseException
- if the supplied value could not be parsed into a valid dateEditableArray.addDate(Date)
public EditableArray addTimestamp(int timeInSeconds, int increment)
EditableArray
addTimestamp
in interface EditableArray
timeInSeconds
- the time in seconds for the new Timestampincrement
- the time increment for the new Timestamp
EditableArray.addDate(Date)
public EditableArray addObjectId(String hex)
EditableArray
addObjectId
in interface EditableArray
hex
- the hexadecimal binary value for the ObjectId
EditableArray.addObjectId(byte[])
,
EditableArray.addObjectId(int, int, int, int)
public EditableArray addObjectId(byte[] bytes)
EditableArray
addObjectId
in interface EditableArray
bytes
- the 12-byte value for the ObjectId
EditableArray.addObjectId(String)
,
EditableArray.addObjectId(int, int, int, int)
public EditableArray addObjectId(int time, int machine, int process, int inc)
EditableArray
addObjectId
in interface EditableArray
time
- 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/runtime
EditableArray.addObjectId(String)
,
EditableArray.addObjectId(byte[])
public EditableArray addRegularExpression(String pattern)
EditableArray
addRegularExpression
in interface EditableArray
pattern
- the regular expression pattern string
public EditableArray addRegularExpression(String pattern, int flags)
EditableArray
addRegularExpression
in interface EditableArray
pattern
- 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_LINES
public EditableArray addNull()
EditableArray
Null
value.
addNull
in interface EditableArray
Document.isNull(String)
,
Document.isNullOrMissing(String)
public EditableArray addBinary(byte type, byte[] data)
EditableArray
Binary
value with the supplied type and content.
addBinary
in interface EditableArray
type
- one of the BSON type
constants denoting the type of the Binary
valuedata
- the bytes for the Binary
value
public EditableArray addUuid(UUID uuid)
EditableArray
addUuid
in interface EditableArray
uuid
- the UUID value
public EditableDocument addCode(String code, boolean includeScope)
EditableArray
Code
with the supplied JavaScript code.
addCode
in interface EditableArray
code
- the codeincludeScope
- true if the code should include a scope (and if this method should return an EditableArray
for
this scope document), or false otherwise
includeScope
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)
EditableArray
CodeWithScope
with the supplied JavaScript code and scope.
addCode
in interface EditableArray
code
- the codescope
- the scope in which the JavaScript code should be evaulated, or null if there is no scope
EditableDocument
for the scope, or null if the scope
reference is nullEditableArray.addCode(String, boolean)
public EditableArray addBooleanIfAbsent(boolean value)
EditableArray
addBooleanIfAbsent
in interface EditableArray
value
- the new value for the field
public EditableArray addNumberIfAbsent(int value)
EditableArray
addNumberIfAbsent
in interface EditableArray
value
- the new value for the field
public EditableArray addNumberIfAbsent(long value)
EditableArray
addNumberIfAbsent
in interface EditableArray
value
- the new value for the field
public EditableArray addNumberIfAbsent(float value)
EditableArray
addNumberIfAbsent
in interface EditableArray
value
- the new value for the field
public EditableArray addNumberIfAbsent(double value)
EditableArray
addNumberIfAbsent
in interface EditableArray
value
- the new value for the field
public EditableArray addStringIfAbsent(String value)
EditableArray
addStringIfAbsent
in interface EditableArray
value
- the new value for the field
public EditableArray addSymbolIfAbsent(String value)
EditableArray
addSymbolIfAbsent
in interface EditableArray
value
- the new value for the field
EditableArray.addString(String)
public EditableDocument addDocumentIfAbsent(Document document)
EditableArray
addDocumentIfAbsent
in interface EditableArray
document
- the document
document
.public EditableArray addArrayIfAbsent(Array array)
EditableArray
addArrayIfAbsent
in interface EditableArray
array
- the array
array
.public EditableArray addDateIfAbsent(Date value)
EditableArray
addDateIfAbsent
in interface EditableArray
value
- the new value for the field
public EditableArray addDateIfAbsent(String isoDate) throws ParseException
EditableArray
addDateIfAbsent
in interface EditableArray
isoDate
- the new value for the field
ParseException
- if the supplied value could not be parsed into a valid dateEditableArray.addDate(Date)
public EditableArray addTimestampIfAbsent(int timeInSeconds, int increment)
EditableArray
addTimestampIfAbsent
in interface EditableArray
timeInSeconds
- the time in seconds for the new Timestampincrement
- the time increment for the new Timestamp
EditableArray.addDate(Date)
public EditableArray addObjectIdIfAbsent(String hex)
EditableArray
addObjectIdIfAbsent
in interface EditableArray
hex
- the hexadecimal binary value for the ObjectId
EditableArray.addObjectId(byte[])
,
EditableArray.addObjectId(int, int, int, int)
public EditableArray addObjectIdIfAbsent(byte[] bytes)
EditableArray
addObjectIdIfAbsent
in interface EditableArray
bytes
- the 12-byte value for the ObjectId
EditableArray.addObjectId(String)
,
EditableArray.addObjectId(int, int, int, int)
public EditableArray addObjectIdIfAbsent(int time, int machine, int process, int inc)
EditableArray
addObjectIdIfAbsent
in interface EditableArray
time
- 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/runtime
EditableArray.addObjectId(String)
,
EditableArray.addObjectId(byte[])
public EditableArray addRegularExpressionIfAbsent(String pattern)
EditableArray
addRegularExpressionIfAbsent
in interface EditableArray
pattern
- the regular expression pattern string
public EditableArray addRegularExpressionIfAbsent(String pattern, int flags)
EditableArray
addRegularExpressionIfAbsent
in interface EditableArray
pattern
- 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_LINES
public EditableArray addNullIfAbsent()
EditableArray
Null
value, if and only if there is not already a null value in the array.
addNullIfAbsent
in interface EditableArray
Document.isNull(String)
,
Document.isNullOrMissing(String)
public EditableArray addBinaryIfAbsent(byte type, byte[] data)
EditableArray
Binary
value with the supplied type and content, if and only if an equivalent value doesn't
already exist in the array.
addBinaryIfAbsent
in interface EditableArray
type
- one of the BSON type
constants denoting the type of the Binary
valuedata
- the bytes for the Binary
value
public EditableArray addUuidIfAbsent(UUID uuid)
EditableArray
addUuidIfAbsent
in interface EditableArray
uuid
- the UUID value
public EditableDocument addCodeIfAbsent(String code, Document scope)
EditableArray
CodeWithScope
with the supplied JavaScript code and scope, if and only if an equivalent value
doesn't already exist in the array.
addCodeIfAbsent
in interface EditableArray
code
- the codescope
- the scope in which the JavaScript code should be evaulated, or null if there is no scope
EditableDocument
for the scope, or null if the scope
reference is nullEditableArray.addCode(String, boolean)
public String toString()
toString
in class Object
|
ModeShape Distribution 3.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |