public abstract class AbstractDescriptor extends Object implements Descriptor
Constructor and Description |
---|
AbstractDescriptor(Document document,
Grammar grammar)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected Element |
addElement(DescriptorTag tag,
Element child,
Element parent)
Adds an element of the specified tag to the descriptor.
|
protected void |
checkElement(Element element,
DescriptorTag expectedTag)
Checks an element whether its name matches the specified name.
|
protected Element |
createNestedText(DescriptorTag tag,
String text)
Creates an element that contains nested text.
|
protected String |
getChildText(Element parent,
DescriptorTag tag)
Returns the text value from a child directly under the parent tag.
|
Document |
getDocument()
Returns the DOM document representing the deployment descriptor.
|
Iterator |
getElements(DescriptorTag tag)
Returns an iterator over the elements that match the specified tag.
|
protected Element |
getImmediateChild(Element parent,
DescriptorTag tag)
Gets a certain tag directly under the parent tag.
|
protected Node |
getInsertionPointFor(DescriptorTag tag,
String parent)
Returns the node before which the specified tag should be inserted, or
null if
the node should be inserted at the end of the descriptor. |
protected Iterator |
getNestedElements(Element parent,
DescriptorTag tag)
Returns an iterator over the child elements of the specified element that match the specified
tag.
|
protected String |
getNestedText(Element parent,
DescriptorTag tag)
Returns the text nested inside a child element of the specified element.
|
Element |
getRootElement() |
protected String |
getText(Element element)
Returns the text value of an element.
|
Element |
replaceElement(DescriptorTag tag,
Element child,
Element parent)
Replaces all elements of the specified tag with the provided element.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFileName
public Document getDocument()
getDocument
in interface Descriptor
public Element getRootElement()
public Iterator getElements(DescriptorTag tag)
tag
- The descriptor tag of which the elements should be returnedprotected void checkElement(Element element, DescriptorTag expectedTag) throws IllegalArgumentException
element
- The element to checkexpectedTag
- The expected tag nameIllegalArgumentException
- If the element name doesn't matchprotected Iterator getNestedElements(Element parent, DescriptorTag tag)
parent
- The element of which the nested elements should be retrievedtag
- The descriptor tag of which the elements should be returnedprotected Element createNestedText(DescriptorTag tag, String text)
tag
- The tag to create an instance oftext
- The text that should be nested in the elementprotected String getNestedText(Element parent, DescriptorTag tag)
parent
- The element of which the nested text should be returnedtag
- The descriptor tag in which the text is nestedprotected String getText(Element element)
element
- the element of wich the text value should be returnedprotected Element getImmediateChild(Element parent, DescriptorTag tag)
parent
- the tag to get the cild fromtag
- name of the child tagprotected String getChildText(Element parent, DescriptorTag tag)
parent
- the parent tag to get the child text fromtag
- the name of the child tagprotected Element addElement(DescriptorTag tag, Element child, Element parent)
tag
- The descriptor tagchild
- The child element to addparent
- The parent element to add the child topublic Element replaceElement(DescriptorTag tag, Element child, Element parent)
tag
- The descriptor tagchild
- The element to replace the current elements withparent
- The parent element to add the child toprotected Node getInsertionPointFor(DescriptorTag tag, String parent)
null
if
the node should be inserted at the end of the descriptor.tag
- The tag that should be insertedparent
- name of the parent tagCopyright © 2004-2013 Codehaus. All Rights Reserved.