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