public abstract class AbstractElement extends Object implements Element
Modifier and Type | Field and Description |
---|---|
protected static Class<Element> |
ELEMENT_TYPE
The base type (interface) for all elements.
|
Constructor and Description |
---|
AbstractElement(String name)
Constructs a new
AbstractElement . |
Modifier and Type | Method and Description |
---|---|
Element |
asElement()
Converts the object into an
Element . |
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.
|
String |
getName()
Returns the name for the BSON type.
|
int |
hashCode()
Computes a reasonable hash code.
|
protected boolean |
nullSafeEquals(Object rhs,
Object lhs)
Does a null safe equals comparison.
|
<E extends Element> |
queryPath(Class<E> clazz,
String... nameRegexs)
Deprecated.
Use the replacement method,
find(Class, String...) .
Will be removed after the 1.1.0 release. |
List<Element> |
queryPath(String... nameRegexs)
Deprecated.
Use the replacement method,
find(String...) . Will be
removed after the 1.1.0 release. |
String |
toString()
String form of the object.
|
public AbstractElement(String name) throws IllegalArgumentException
AbstractElement
.name
- The name for the BSON type.IllegalArgumentException
- If the name
is null
.public Element asElement()
Element
.
Returns this element.
asElement
in interface ElementAssignable
Element
.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 a singleton list if the nameRegexs is empty and this element's type is assignable to E. An empty list otherwise.
find
in interface Element
E
- 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 List<Element> find(String... nameRegexs)
Returns a singleton list if the nameRegexs is empty. An empty list otherwise.
find
in interface Element
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.
findFirst
in interface Element
E
- The type of element to match.clazz
- The class of element to match.nameRegexs
- The path of regular expressions.Element.findFirst(java.lang.Class<E>, java.lang.String...)
public Element findFirst(String... nameRegexs)
Searches this sub-elements for matching elements on the path and are of the right type.
findFirst
in interface Element
nameRegexs
- The path of regular expressions.Document.queryPath(java.lang.Class<E>, java.lang.String...)
public String getName()
public int hashCode()
@Deprecated public <E extends Element> List<E> queryPath(Class<E> clazz, String... nameRegexs)
find(Class, String...)
.
Will be removed after the 1.1.0 release.
To call the replacement method, find(Class, String...)
.
queryPath
in interface Element
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(String...)
. Will be
removed after the 1.1.0 release.
To call the replacement method, find(String...)
.
queryPath
in interface Element
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.