public class RootDocument extends AbstractDocument
ELEMENT_TYPE, EMPTY_ELEMENTS
Constructor and Description |
---|
RootDocument(Element... elements)
Constructs a new
RootDocument . |
RootDocument(List<Element> elements)
Constructs a new
RootDocument . |
RootDocument(List<Element> elements,
boolean idPresent)
Constructs a new
RootDocument . |
RootDocument(List<Element> elements,
boolean idPresent,
long size)
Constructs a new
RootDocument . |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(String name)
Returns true if the document contains an element with the specified name.
|
protected Map<String,Element> |
getElementMap()
Returns a map from the element names to the elements in the document.
|
List<Element> |
getElements()
Returns the elements in the document.
|
void |
injectId()
Adds an
ObjectIdElement to the head of the document. |
long |
size()
Returns the size of the document when encoded as bytes.
|
public RootDocument(Element... elements)
RootDocument
.elements
- The elements for the BSON document.public RootDocument(List<Element> elements)
RootDocument
.elements
- The elements for the BSON document.public RootDocument(List<Element> elements, boolean idPresent)
RootDocument
.elements
- The elements for the BSON document.idPresent
- If true then there is an _id element in the list of elements.public RootDocument(List<Element> elements, boolean idPresent, long size)
RootDocument
.elements
- The elements for the BSON document.idPresent
- If true then there is an _id element in the list of elements.size
- The size of the document when encoded in bytes. If not known
then use the RootDocument(List, boolean)
constructor instead.public boolean contains(String name)
contains
in interface Document
contains
in class AbstractDocument
name
- The name of the element to locate.Document.contains(String)
public List<Element> getElements()
getElements
in interface Document
getElements
in class AbstractDocument
public void injectId()
ObjectIdElement
to the head of the document.public long size()
protected Map<String,Element> getElementMap()
getElementMap
in class AbstractDocument
Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.