|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jvnet.hk2.config.ConfigParser
public class ConfigParser
Parses configuration files, builds Inhabitant
s,
and add them to Habitat
.
This class also maintains the model of various elements in the configuration file.
This class can be sub-classed to create a ConfigParser
with a custom non-standard behavior.
Field Summary | |
---|---|
protected Habitat |
habitat
This is where we put parsed inhabitants into. |
Constructor Summary | |
---|---|
ConfigParser(Habitat habitat)
|
Method Summary | |
---|---|
protected Dom |
handleElement(XMLStreamReader in,
DomDocument document,
Dom parent)
Parses a whole XML tree and builds a Dom tree. |
protected Dom |
handleElement(XMLStreamReader in,
DomDocument document,
Dom parent,
ConfigModel model)
Parses a whole XML tree and builds a Dom tree, by using the given model
for the top-level element. |
DomDocument |
parse(URL source)
Parses the given source as a config file, and adds resulting Dom s into Habitat as Inhabitant s. |
DomDocument |
parse(URL source,
DomDocument document)
|
DomDocument |
parse(URL source,
DomDocument document,
Dom parent)
|
DomDocument |
parse(XMLStreamReader in)
|
void |
parse(XMLStreamReader in,
DomDocument document)
|
void |
parse(XMLStreamReader in,
DomDocument document,
Dom parent)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Habitat habitat
Constructor Detail |
---|
public ConfigParser(Habitat habitat)
Method Detail |
---|
public DomDocument parse(XMLStreamReader in) throws XMLStreamException
XMLStreamException
public void parse(XMLStreamReader in, DomDocument document) throws XMLStreamException
XMLStreamException
public void parse(XMLStreamReader in, DomDocument document, Dom parent) throws XMLStreamException
XMLStreamException
public DomDocument parse(URL source)
Dom
s into Habitat
as Inhabitant
s.
public DomDocument parse(URL source, DomDocument document)
public DomDocument parse(URL source, DomDocument document, Dom parent)
protected Dom handleElement(XMLStreamReader in, DomDocument document, Dom parent) throws XMLStreamException
Dom
tree.
This is the entry point for the root element of a configuration tree.
in
- pre-condition: 'in' is at the start element.
post-condition: 'in' is at the end element.document
- The document that we are building right now.
Newly created Dom
will belong to this document.parent
- The parent element
Dom
object.
XMLStreamException
protected Dom handleElement(XMLStreamReader in, DomDocument document, Dom parent, ConfigModel model) throws XMLStreamException
Dom
tree, by using the given model
for the top-level element.
This is the entry point for recursively parsing inside a configuration tree.
Since not every element is global, you don't always want to infer the model
just from the element name (as is the case with handleElement(XMLStreamReader, DomDocument, Dom)
.
in
- pre-condition: 'in' is at the start element.
post-condition: 'in' is at the end element.document
- The document that we are building right now.
Newly created Dom
will belong to this document.parent
- The parent element
Dom
object.
XMLStreamException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |