public interface DocumentBuilder extends Builder, DocumentAssignable
| Modifier and Type | Method and Description |
|---|---|
DocumentBuilder |
add(ElementAssignable element)
Adds a pre-built element to the document.
|
DocumentBuilder |
add(String name,
boolean value)
Adds a boolean element.
|
DocumentBuilder |
add(String name,
byte[] data)
Adds a binary element using sub-type zero (the default).
|
DocumentBuilder |
add(String name,
byte subType,
byte[] data)
Adds a binary element.
|
DocumentBuilder |
add(String name,
Date timestamp)
Adds a timestamp element.
|
DocumentBuilder |
add(String name,
DocumentAssignable document)
Adds a pre-constructed document to the array.
|
DocumentBuilder |
add(String name,
double value)
Adds a double element.
|
DocumentBuilder |
add(String name,
int value)
Adds a integer (32-bit signed) element.
|
DocumentBuilder |
add(String name,
long value)
Adds a long (64-bit signed) element.
|
DocumentBuilder |
add(String name,
ObjectId id)
Adds an ObjectId element.
|
DocumentBuilder |
add(String name,
Pattern pattern)
Adds an ObjectId element.
|
DocumentBuilder |
add(String name,
String value)
Adds a string element.
|
DocumentBuilder |
add(String name,
String databaseName,
String collectionName,
ObjectId id)
Deprecated.
See BSON specification.
|
DocumentBuilder |
addBinary(String name,
byte[] data)
Adds a binary element using sub-type zero (the default).
|
DocumentBuilder |
addBinary(String name,
byte subType,
byte[] data)
Adds a binary element using sub-type zero (the default).
|
DocumentBuilder |
addBoolean(String name,
boolean value)
Adds a boolean element.
|
DocumentBuilder |
addDBPointer(String name,
String databaseName,
String collectionName,
ObjectId id)
Deprecated.
See BSON specification.
|
DocumentBuilder |
addDocument(String name,
DocumentAssignable value)
Adds a pre-built document element.
|
DocumentBuilder |
addDouble(String name,
double value)
Adds a double element.
|
DocumentBuilder |
addInteger(String name,
int value)
Adds a integer (32-bit signed) element.
|
DocumentBuilder |
addJavaScript(String name,
String code)
Adds a JavaScript element.
|
DocumentBuilder |
addJavaScript(String name,
String code,
DocumentAssignable scope)
Adds a JavaScript with Scope element.
|
DocumentBuilder |
addLong(String name,
long value)
Adds a long (64-bit signed) element.
|
DocumentBuilder |
addMaxKey(String name)
Adds a minimum key value element.
|
DocumentBuilder |
addMinKey(String name)
Adds a minimum key value element.
|
DocumentBuilder |
addMongoTimestamp(String name,
long value)
Adds a MongoDB Timestamp element.
|
DocumentBuilder |
addNull(String name)
Adds a
null valued element. |
DocumentBuilder |
addObjectId(String name,
ObjectId id)
Adds an ObjectId element.
|
DocumentBuilder |
addRegularExpression(String name,
Pattern pattern)
Adds a regular expression element.
|
DocumentBuilder |
addRegularExpression(String name,
String pattern,
String options)
Adds a regular expression element.
|
DocumentBuilder |
addString(String name,
String value)
Adds a string element.
|
DocumentBuilder |
addSymbol(String name,
String symbol)
Adds a symbol element.
|
DocumentBuilder |
addTimestamp(String name,
long timestamp)
Adds a timestamp element.
|
Document |
build()
Returns the
Document being constructed. |
DocumentBuilder |
push(String name)
Pushes a context for constructing a sub-document.
|
ArrayBuilder |
pushArray(String name)
Pushes a context for constructing a sub-array.
|
DocumentBuilder |
reset()
Resets the builder back to an empty state.
|
asDocumentDocumentBuilder add(ElementAssignable element)
element - The element to add.DocumentBuilder for method chaining.DocumentBuilder add(String name, boolean value)
This is a equivalent to addBoolean(String,boolean) but less
verbose.
name - The name of the element.value - The boolean value.DocumentBuilder for method chaining.DocumentBuilder add(String name, byte subType, byte[] data)
This is a equivalent to addBinary(String,byte, byte[]) but less
verbose.
name - The name of the element.subType - The sub-type for the binary data.data - The binary value.DocumentBuilder for method chaining.DocumentBuilder add(String name, byte[] data)
This is a equivalent to addBinary(String,byte[]) but less
verbose.
name - The name of the element.data - The binary value.DocumentBuilder for method chaining.DocumentBuilder add(String name, Date timestamp)
This is a equivalent to addTimeStamp(timestamp.getTime()) but less verbose.
name - The name of the element.timestamp - The number of milliseconds since the Unix epoch.DocumentBuilder for method chaining.DocumentBuilder add(String name, DocumentAssignable document)
This is a equivalent to addDocument(String,DocumentAssignable)
but less verbose.
name - The name of the element.document - The document to add to the array.DocumentBuilder for method chaining.DocumentBuilder add(String name, double value)
This is a equivalent to addDouble(String,double) but less
verbose.
name - The name of the element.value - The double value.DocumentBuilder for method chaining.DocumentBuilder add(String name, int value)
This is a equivalent to addInteger(String,int) but less verbose.
name - The name of the element.value - The integer value.DocumentBuilder for method chaining.DocumentBuilder add(String name, long value)
This is a equivalent to addLong(String,long) but less verbose.
name - The name of the element.value - The long value.DocumentBuilder for method chaining.DocumentBuilder add(String name, ObjectId id)
This is a equivalent to addObjectId(String,ObjectId) but less
verbose.
name - The name of the element.id - The ObjectId to add.DocumentBuilder for method chaining.DocumentBuilder add(String name, Pattern pattern)
This is a equivalent to addRegularExpression(String,Pattern) but
less verbose.
name - The name of the element.pattern - The pattern for the regular expression.DocumentBuilder for method chaining.DocumentBuilder add(String name, String value)
This is a equivalent to addString(String,String) but less
verbose.
name - The name of the element.value - The string value.DocumentBuilder for method chaining.@Deprecated DocumentBuilder add(String name, String databaseName, String collectionName, ObjectId id)
This is a equivalent to
addDBPointer(String,String, String, ObjectId) but less verbose.
name - The name of the element.databaseName - The name of the database containing the document.collectionName - The name of the collection containing the document.id - The id for the document.DocumentBuilder for method chaining.DocumentBuilder addBinary(String name, byte subType, byte[] data)
name - The name of the element.subType - The sub-type for the binary data.data - The binary value.DocumentBuilder for method chaining.DocumentBuilder addBinary(String name, byte[] data)
name - The name of the element.data - The binary value.DocumentBuilder for method chaining.DocumentBuilder addBoolean(String name, boolean value)
name - The name of the element.value - The boolean value.DocumentBuilder for method chaining.@Deprecated DocumentBuilder addDBPointer(String name, String databaseName, String collectionName, ObjectId id)
name - The name of the element.databaseName - The name of the database containing the document.collectionName - The name of the collection containing the document.id - The id for the document.DocumentBuilder for method chaining.DocumentBuilder addDocument(String name, DocumentAssignable value)
push(String) a sub
document.name - The name of the element.value - The document value.DocumentBuilder for method chaining.DocumentBuilder addDouble(String name, double value)
name - The name of the element.value - The double value.DocumentBuilder for method chaining.DocumentBuilder addInteger(String name, int value)
name - The name of the element.value - The integer value.DocumentBuilder for method chaining.DocumentBuilder addJavaScript(String name, String code)
name - The name of the element.code - The java script code.DocumentBuilder for method chaining.DocumentBuilder addJavaScript(String name, String code, DocumentAssignable scope)
name - The name of the element.code - The java script code.scope - The scope for the JacaScript code.DocumentBuilder for method chaining.DocumentBuilder addLong(String name, long value)
name - The name of the element.value - The long value.DocumentBuilder for method chaining.DocumentBuilder addMaxKey(String name)
name - The name of the element.DocumentBuilder for method chaining.DocumentBuilder addMinKey(String name)
name - The name of the element.DocumentBuilder for method chaining.DocumentBuilder addMongoTimestamp(String name, long value)
name - The name of the element.value - The mongoDB timstamp value.DocumentBuilder for method chaining.DocumentBuilder addNull(String name)
null valued element.name - The name of the element.DocumentBuilder for method chaining.DocumentBuilder addObjectId(String name, ObjectId id)
name - The name of the element.id - The ObjectId to add.DocumentBuilder for method chaining.DocumentBuilder addRegularExpression(String name, Pattern pattern)
name - The name of the element.pattern - The pattern for the regular expression.DocumentBuilder for method chaining.DocumentBuilder addRegularExpression(String name, String pattern, String options)
name - The name of the element.pattern - The pattern for the regular expression.options - The regular expression options. See the BSON specification for
details.DocumentBuilder for method chaining.DocumentBuilder addString(String name, String value)
name - The name of the element.value - The string value.DocumentBuilder for method chaining.DocumentBuilder addSymbol(String name, String symbol)
name - The name of the element.symbol - The symbol value.DocumentBuilder for method chaining.DocumentBuilder addTimestamp(String name, long timestamp)
name - The name of the element.timestamp - The number of milliseconds since the Unix epoch.DocumentBuilder for method chaining.DocumentBuilder push(String name)
name - The name of the sub-document.DocumentBuilder for constructing the sub-document.ArrayBuilder pushArray(String name)
name - The name of the sub-array.ArrayBuilder for constructing the sub-array.DocumentBuilder reset()
Overridden to return an DocumentBuilder instance.
Copyright © 2011-2012 Allanbank Consulting, Inc.. All Rights Reserved.