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 boolean |
containsElement(List<org.jdom.Element> haystack,
org.jdom.Element needle)
Checks if
haystack contains needle. |
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.
|
protected List<org.jdom.Content> |
getContentExceptComments(org.jdom.Element element)
Gets the content of an element (excluding comments).
|
DescriptorType |
getDescriptorType()
Get the descriptor type for this descriptor.
|
org.jdom.Document |
getDocument()
Return the representation as a document.
|
List<org.jdom.Element> |
getElements(DescriptorTag tag)
Returns a list of the elements that match the specified tag.
|
List<org.jdom.Element> |
getElements(String tagName)
Returns a list of 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 List<org.jdom.Element> |
getNestedElements(org.jdom.Element parent,
DescriptorTag tag)
Returns a list of 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<org.jdom.Element> |
getTags(DescriptorTag tag)
Get tags of a particular type.
|
List<org.jdom.Element> |
getTags(String tagName)
Get tags of a particular type.
|
protected String |
getText(org.jdom.Element element)
Returns the text value of an element.
|
protected boolean |
sameContent(org.jdom.Element element1,
org.jdom.Element element2)
Checks if two elements have the same content (excluding comments).
|
protected boolean |
sameElement(org.jdom.Element element1,
org.jdom.Element element2)
Checks if two elements are the same.
|
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, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitgetFileName, getRootElementpublic 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 DescriptorgetDocument in interface org.jdom.ParentgetDocument in class org.jdom.Documentpublic List<org.jdom.Element> getTags(DescriptorTag tag)
getTags in interface Descriptortag - type of elements to findpublic List<org.jdom.Element> getTags(String tagName)
getTags in interface DescriptortagName - type of elements to findpublic List<org.jdom.Element> getElements(DescriptorTag tag)
tag - The descriptor tag of which the elements should be returnedpublic List<org.jdom.Element> 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 List<org.jdom.Element> 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 Descriptortag - The descriptor tagchild - The child element to addparent - The parent element to add the child toprotected boolean containsElement(List<org.jdom.Element> haystack, org.jdom.Element needle)
haystack contains needle.haystack - List of element to look into.needle - Element to look for.haystack contains needle.protected boolean sameElement(org.jdom.Element element1,
org.jdom.Element element2)
element1 - First element.element2 - Second element.element1 and element2 are the same.protected boolean sameContent(org.jdom.Element element1,
org.jdom.Element element2)
element1 - First element.element2 - Second element.element1 and element2 have the same content
(excluding comments).protected List<org.jdom.Content> getContentExceptComments(org.jdom.Element element)
element - Element to get the contents for.element (excluding comments).protected 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()
DescriptorgetDescriptorType in interface Descriptorpublic org.jdom.Element getTagByIdentifier(DescriptorTag tag, String value)
getTagByIdentifier in interface Descriptortag - tag to search forvalue - value for the identifier to matchpublic org.jdom.Element getTagByIdentifier(String tagName, String value)
getTagByIdentifier in interface DescriptortagName - Name of the tag to search forvalue - value for the identifier to matchCopyright © 2004-2013 Codehaus. All Rights Reserved.