public class ArrayElement extends AbstractElement
| Modifier and Type | Field and Description |
|---|---|
static ElementType |
TYPE
The BSON type for an array.
|
ELEMENT_TYPE| Constructor and Description |
|---|
ArrayElement(String name,
Element... entries)
Constructs a new
ArrayElement. |
ArrayElement(String name,
List<Element> entries)
Constructs a new
ArrayElement. |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Visitor visitor)
Accepts the visitor and calls the
Visitor.visitArray(String, List) method. |
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.
|
<E extends Element> |
findFirst(Class<E> clazz,
String... nameRegexs)
Returns the first element matching the path of regular expressions.
|
List<Element> |
getEntries()
Returns the entries in the array.
|
ElementType |
getType()
Returns the type for the BSON type.
|
int |
hashCode()
Computes a reasonable hash code.
|
ArrayElement |
withName(String name)
Creates a new element with the same type and value as this element but
with the specified name.
|
asElement, find, findFirst, getName, nullSafeEquals, queryPath, queryPath, toStringpublic static final ElementType TYPE
public ArrayElement(String name, Element... entries) throws IllegalArgumentException
ArrayElement.name - The name for the BSON array.entries - The entries in the array.IllegalArgumentException - If the name is null.public ArrayElement(String name, List<Element> entries) throws IllegalArgumentException
ArrayElement.name - The name for the BSON array.entries - The entries in the array.IllegalArgumentException - If the name is null.public void accept(Visitor visitor)
Visitor.visitArray(String, List) method.visitor - The visitor for the element.Element.accept(Visitor)public boolean equals(Object object)
equals in class AbstractElementobject - The object to compare to.Object.equals(java.lang.Object)public <E extends Element> List<E> find(Class<E> clazz, String... nameRegexs)
Returns a singleton list if the nameRegexs is empty and this element's type is assignable to E. An empty list otherwise.
Searches this sub-elements for matching elements on the path and are of the right type.
find in interface Elementfind in class AbstractElementE - The type of element to match.clazz - The class of elements to match.nameRegexs - The path of regular expressions.Element.queryPath(java.lang.Class<E>, java.lang.String...)public <E extends Element> E findFirst(Class<E> clazz, String... nameRegexs)
Returns a this if the nameRegexs is empty and this element's type
is assignable to E. An empty list otherwise.
Searches this sub-elements for matching elements on the path and are of the right type.
findFirst in interface ElementfindFirst in class AbstractElementE - 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 List<Element> getEntries()
public ElementType getType()
public int hashCode()
hashCode in class AbstractElementpublic ArrayElement withName(String name)
Returns a new ArrayElement.
name - The new name for the element.Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.