public abstract class AbstractDescriptor extends org.jdom.Document implements Descriptor
Constructor and Description |
---|
AbstractDescriptor(org.jdom.Element rootElement,
DescriptorType descriptorType)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
org.jdom.Element |
addElement(DescriptorTag tag,
org.jdom.Element child,
org.jdom.Element parent)
Adds an element of the specified tag to the descriptor.
|
protected void |
checkElement(org.jdom.Element element,
DescriptorTag expectedTag)
Checks an element whether its name matches the specified name.
|
protected org.jdom.Element |
createNestedText(DescriptorTag tag,
String text)
Creates an element that contains nested text.
|
protected String |
getChildText(org.jdom.Element parent,
DescriptorTag tag)
Returns the text value from a child directly under the parent tag.
|
protected String |
getChildText(org.jdom.Element parent,
String tagName)
Returns the text value from a child directly under the parent tag.
|
DescriptorType |
getDescriptorType()
Get the descriptor type for this descriptor.
|
org.jdom.Document |
getDocument()
Return the representation as a document.
|
Iterator |
getElements(DescriptorTag tag)
Returns an iterator over the elements that match the specified tag.
|
Iterator |
getElements(String tagName)
Returns an iterator over the elements that match the specified tag.
|
protected org.jdom.Element |
getImmediateChild(org.jdom.Element parent,
DescriptorTag tag)
Gets a certain tag directly under the parent tag.
|
protected org.jdom.Element |
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(org.jdom.Element parent,
DescriptorTag tag)
Returns an iterator over the child elements of the specified element that match the specified
tag.
|
protected String |
getNestedText(org.jdom.Element parent,
DescriptorTag tag)
Returns the text nested inside a child element of the specified element.
|
org.jdom.Element |
getTagByIdentifier(DescriptorTag tag,
String value)
Get elements of a particular descriptor tag whose identifier matches the passed parameter.
|
org.jdom.Element |
getTagByIdentifier(String tagName,
String value)
Get elements of a particular descriptor tag whose identifier matches the passed parameter.
|
List |
getTags(DescriptorTag tag)
Get tags of a particular type.
|
List |
getTags(String tagName)
Get tags of a particular type.
|
protected String |
getText(org.jdom.Element element)
Returns the text value of an element.
|
addContent, addContent, addContent, addContent, clone, cloneContent, detachRootElement, equals, getBaseURI, getContent, getContent, getContent, getContentSize, getDescendants, getDescendants, getDocType, getParent, getProperty, getRootElement, hashCode, hasRootElement, indexOf, removeContent, removeContent, removeContent, removeContent, setBaseURI, setContent, setContent, setContent, setContent, setDocType, setProperty, setRootElement, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
getFileName, getRootElement
public AbstractDescriptor(org.jdom.Element rootElement, DescriptorType descriptorType)
rootElement
- The root element of the documentdescriptorType
- The type of the descriptorpublic org.jdom.Document getDocument()
getDocument
in interface Descriptor
getDocument
in interface org.jdom.Parent
getDocument
in class org.jdom.Document
public List getTags(DescriptorTag tag)
getTags
in interface Descriptor
tag
- type of elements to findpublic List getTags(String tagName)
tagName
- type of elements to findpublic Iterator getElements(DescriptorTag tag)
tag
- The descriptor tag of which the elements should be returnedpublic Iterator getElements(String tagName)
tagName
- The name of a descriptor tag of which the elements should be returnedprotected void checkElement(org.jdom.Element element, DescriptorTag expectedTag) throws IllegalArgumentException
element
- The element to checkexpectedTag
- The expected tag nameIllegalArgumentException
- If the element name doesn't matchprotected Iterator getNestedElements(org.jdom.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 org.jdom.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(org.jdom.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(org.jdom.Element element)
element
- the element of wich the text value should be returnedprotected org.jdom.Element getImmediateChild(org.jdom.Element parent, DescriptorTag tag)
parent
- the tag to get the cild fromtag
- name of the child tagprotected String getChildText(org.jdom.Element parent, DescriptorTag tag)
parent
- the parent tag to get the child text fromtag
- the name of the child tagprotected String getChildText(org.jdom.Element parent, String tagName)
parent
- the parent tag to get the child text fromtagName
- the name of the child tagpublic org.jdom.Element addElement(DescriptorTag tag, org.jdom.Element child, org.jdom.Element parent)
addElement
in interface Descriptor
tag
- The descriptor tagchild
- The child element to addparent
- The parent element to add the child toprotected org.jdom.Element 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 tagpublic DescriptorType getDescriptorType()
Descriptor
getDescriptorType
in interface Descriptor
public org.jdom.Element getTagByIdentifier(DescriptorTag tag, String value)
getTagByIdentifier
in interface Descriptor
tag
- tag to search forvalue
- value for the identifier to matchpublic org.jdom.Element getTagByIdentifier(String tagName, String value)
tagName
- Name of the tag to search forvalue
- value for the identifier to matchCopyright © 2004-2013 Codehaus. All Rights Reserved.