public class EmptyDocument extends Object implements Document
| Modifier and Type | Field and Description |
|---|---|
static List<Element> |
EMPTY_ELEMENTS
The empty list of elements.
|
static EmptyDocument |
INSTANCE
An instance of the Empty Document.
|
| Constructor and Description |
|---|
EmptyDocument()
Constructs a new
EmptyDocument. |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Visitor visitor)
Accepts the visitor and calls the
Visitor.visitDocument(java.lang.String, java.util.List<com.allanbank.mongodb.bson.Element>) method. |
Document |
asDocument()
Converts the object into a document.
|
boolean |
contains(String name)
Returns false since this document contains no
Elements. |
boolean |
equals(Object object)
Determines if the passed object is of this same type as this object and
if so that its fields are equal.
|
<E extends Element> |
find(Class<E> clazz,
String... nameRegexs)
Returns the elements matching the path of regular expressions.
|
List<Element> |
find(String... nameRegexs)
Returns the elements matching the path of regular expressions.
|
<E extends Element> |
findFirst(Class<E> clazz,
String... nameRegexs)
Returns the first element matching the path of regular expressions.
|
Element |
findFirst(String... nameRegexs)
Returns the first element matching the path of regular expressions.
|
<E extends Element> |
get(Class<E> clazz,
String name)
Returns an empty list of elements.
|
Element |
get(String name)
Returns an empty list of elements.
|
List<Element> |
getElements()
Returns an empty list of elements.
|
int |
hashCode()
Computes a reasonable hash code.
|
Iterator<Element> |
iterator()
Returns an iterator over an empty list of elements.
|
<E extends Element> |
queryPath(Class<E> clazz,
String... nameRegexs)
Deprecated.
Use the
find(Class,String...) method instead. Will
be removed after the 1.1.0 release. |
List<Element> |
queryPath(String... nameRegexs)
Deprecated.
Use the
find(Class,String...) method instead. Will
be removed after the 1.1.0 release. |
String |
toString()
String form of the object.
|
public static final EmptyDocument INSTANCE
public EmptyDocument()
EmptyDocument.public void accept(Visitor visitor)
Visitor.visitDocument(java.lang.String, java.util.List<com.allanbank.mongodb.bson.Element>) method.accept in interface Documentvisitor - THe visitor for the document.Element.accept(Visitor)public Document asDocument()
Returns this document.
asDocument in interface DocumentAssignablepublic boolean contains(String name)
Elements.contains in interface Documentname - The name of the element to locate.Document.contains(String)public boolean equals(Object object)
equals in class Objectobject - The object to compare to.Object.equals(java.lang.Object)public <E extends Element> List<E> find(Class<E> clazz, String... nameRegexs)
Returns an empty list of elements.
find in interface DocumentE - The type of element to match.clazz - The class of elements to match.nameRegexs - The path of regular expressions.null.Document.queryPath(java.lang.Class<E>, java.lang.String...)public List<Element> find(String... nameRegexs)
Returns an empty list of elements.
find in interface DocumentnameRegexs - The path of regular expressions.null.Document.queryPath(java.lang.Class<E>, java.lang.String...)public <E extends Element> E findFirst(Class<E> clazz, String... nameRegexs)
Note: It is much faster to use the Document.get(Class,String) method on a
document than to use the Document.findFirst(String...) with a single
nameRegexs.
Return null.
findFirst in interface DocumentE - The type of element to match.clazz - The class of element to match.nameRegexs - The path of regular expressions.Document.queryPath(java.lang.Class<E>, java.lang.String...)public Element findFirst(String... nameRegexs)
Note: It is much faster to use the Document.get(String) method on a
document than to use the Document.findFirst(String...) with a single
nameRegexs.
Returns null.
findFirst in interface DocumentnameRegexs - The path of regular expressions.Document.queryPath(java.lang.Class<E>, java.lang.String...)public <E extends Element> E get(Class<E> clazz, String name)
get in interface DocumentE - The type of element to get.clazz - The class of element to get.name - The name of the element to locate.Document.get(String)public Element get(String name)
get in interface Documentname - The name of the element to locate.Document.get(String)public List<Element> getElements()
getElements in interface Documentpublic int hashCode()
public Iterator<Element> iterator()
iterator in interface Iterable<Element>Iterable.iterator()@Deprecated public <E extends Element> List<E> queryPath(Class<E> clazz, String... nameRegexs)
find(Class,String...) method instead. Will
be removed after the 1.1.0 release.Returns an empty list of elements.
queryPath in interface DocumentE - The type of element to match.clazz - The class of elements to match.nameRegexs - The path of regular expressions.Document.queryPath(java.lang.Class<E>, java.lang.String...)@Deprecated public List<Element> queryPath(String... nameRegexs)
find(Class,String...) method instead. Will
be removed after the 1.1.0 release.Returns an empty list of elements.
queryPath in interface DocumentnameRegexs - The path of regular expressions.Document.queryPath(java.lang.Class<E>, java.lang.String...)public String toString()
toString in class ObjectObject.toString()Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.