public interface Visitor
Element
calls the appropriate Visit method in this interface
The user is responsible for recursively navigating the structure.Modifier and Type | Method and Description |
---|---|
void |
visit(List<Element> elements)
Visit the root document.
|
void |
visitArray(String name,
List<Element> elements)
Visits an array of elements.
|
void |
visitBinary(String name,
byte subType,
byte[] data)
Visits a binary element.
|
void |
visitBoolean(String name,
boolean value)
Visits a boolean element.
|
void |
visitDBPointer(String name,
String databaseName,
String collectionName,
ObjectId id)
Visits a deprecated DBPointer element.
|
void |
visitDocument(String name,
List<Element> elements)
Visits a sub-document element.
|
void |
visitDouble(String name,
double value)
Visits a double element.
|
void |
visitInteger(String name,
int value)
Visits a integer (32-bit signed) element.
|
void |
visitJavaScript(String name,
String code)
Visits a JavaScript element.
|
void |
visitJavaScript(String name,
String code,
Document scope)
Visits a JavaScript with Scope element.
|
void |
visitLong(String name,
long value)
Visits a long (64-bit signed) element.
|
void |
visitMaxKey(String name)
Visits a minimum key value element.
|
void |
visitMinKey(String name)
Visits a minimum key value element.
|
void |
visitMongoTimestamp(String name,
long value)
Visits a MongoDB Timestamp element.
|
void |
visitNull(String name)
Visits a
null valued element. |
void |
visitObjectId(String name,
ObjectId id)
Visits an ObjectId element.
|
void |
visitRegularExpression(String name,
String pattern,
String options)
Visits a regular expression element.
|
void |
visitString(String name,
String value)
Visits a string element.
|
void |
visitSymbol(String name,
String symbol)
Visits a symbol element.
|
void |
visitTimestamp(String name,
long timestamp)
Visits a timestamp element.
|
void visit(List<Element> elements)
Implementations of Document
may see a significant performance
enhancement if they ensure that the list of elements is the same list.
(Identify check instead of Object.equals(Object)
.
elements
- The sub elements of the document.void visitArray(String name, List<Element> elements)
The ArrayElement
implementation ensures that the list of elements
is always the same list. Visitors may use this fact to cache intermediate
results.
name
- The name of the element.elements
- The elements in the array.void visitBinary(String name, byte subType, byte[] data)
name
- The name of the element.subType
- The binary data sub type.data
- The binary data.void visitBoolean(String name, boolean value)
name
- The name of the element.value
- The boolean value.void visitDBPointer(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.void visitDocument(String name, List<Element> elements)
The DocumentElement
implementation ensures that the list of
elements is always the same list. Visitors may use this fact to cache
intermediate results.
name
- The name of the element.elements
- The sub elements of the document.void visitDouble(String name, double value)
name
- The name of the element.value
- The double value.void visitInteger(String name, int value)
name
- The name of the element.value
- The integer value.void visitJavaScript(String name, String code)
name
- The name of the element.code
- The java script code.void visitJavaScript(String name, String code, Document scope)
name
- The name of the element.code
- The java script code.scope
- The scope for the JacaScript code.void visitLong(String name, long value)
name
- The name of the element.value
- The long value.void visitMaxKey(String name)
name
- The name of the element.void visitMinKey(String name)
name
- The name of the element.void visitMongoTimestamp(String name, long value)
name
- The name of the element.value
- The mongoDB timstamp value.void visitNull(String name)
null
valued element.name
- The name of the element.void visitObjectId(String name, ObjectId id)
name
- The name of the element.id
- The object id.void visitRegularExpression(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.void visitString(String name, String value)
name
- The name of the element.value
- The string value.void visitSymbol(String name, String symbol)
name
- The name of the element.symbol
- The symbol value.void visitTimestamp(String name, long timestamp)
name
- The name of the element.timestamp
- The number of milliseconds since the Unix epoch.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.