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
Element s. |
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 Document
visitor
- THe visitor for the document.Element.accept(Visitor)
public Document asDocument()
Returns this document.
asDocument
in interface DocumentAssignable
public boolean contains(String name)
Element
s.contains
in interface Document
name
- The name of the element to locate.Document.contains(String)
public boolean equals(Object object)
equals
in class Object
object
- 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 Document
E
- 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 Document
nameRegexs
- 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 Document
E
- 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 Document
nameRegexs
- 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 Document
E
- 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 Document
name
- The name of the element to locate.Document.get(String)
public List<Element> getElements()
getElements
in interface Document
public 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 Document
E
- 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 Document
nameRegexs
- The path of regular expressions.Document.queryPath(java.lang.Class<E>, java.lang.String...)
public String toString()
toString
in class Object
Object.toString()
Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.