public interface Document extends Iterable<Element>, DocumentAssignable, Serializable
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor visitor)
Accepts the visitor and calls the appropriate method on the visitor based
on the document type.
|
boolean |
contains(String name)
Returns true if the document contains an element with the specified name.
|
<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 the element with the specified name or null if no element with
that name exists.
|
Element |
get(String name)
Returns the element with the specified name or null if no element with
that name exists.
|
List<Element> |
getElements()
Returns the array of elements that create this document.
|
long |
size()
Returns the size of the document when encoded as bytes.
|
asDocument
void accept(Visitor visitor)
visitor
- THe visitor for the document.boolean contains(String name)
name
- The name of the element to locate.<E extends Element> List<E> find(Class<E> clazz, String... nameRegexs)
E
- The type of element to match.clazz
- The class of elements to match.nameRegexs
- The path of regular expressions.null
.List<Element> find(String... nameRegexs)
nameRegexs
- The path of regular expressions.null
.<E extends Element> E findFirst(Class<E> clazz, String... nameRegexs)
Note: It is much faster to use the get(Class,String)
method on a
document than to use the findFirst(String...)
with a single
nameRegexs
.
E
- The type of element to match.clazz
- The class of element to match.nameRegexs
- The path of regular expressions.Element findFirst(String... nameRegexs)
Note: It is much faster to use the get(String)
method on a
document than to use the findFirst(String...)
with a single
nameRegexs
.
nameRegexs
- The path of regular expressions.<E extends Element> E get(Class<E> clazz, String name)
E
- The type of element to get.clazz
- The class of element to get.name
- The name of the element to locate.Element get(String name)
name
- The name of the element to locate.List<Element> getElements()
long size()
Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.