Package io.wcm.handler.commons.dom
Class AbstractElement
java.lang.Object
org.jdom2.Content
org.jdom2.Element
io.wcm.handler.commons.dom.AbstractElement
- All Implemented Interfaces:
Serializable,Cloneable,org.jdom2.NamespaceAware,org.jdom2.Parent
- Direct Known Subclasses:
AbstractHtmlElementFactory
@ConsumerType
public abstract class AbstractElement
extends org.jdom2.Element
Generic DOM element.
This element implementation is derived from JDOM element implementation.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jdom2.Content
org.jdom2.Content.CType -
Field Summary
Fields inherited from class org.jdom2.Element
name, namespaceFields inherited from class org.jdom2.Content
ctype, parent -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal <T extends AbstractElement>
Tadd(T element) Appends the child to the end of the element's content list.final org.jdom2.ElementaddContent(int index, Collection collection) Inserts the content in a collection into the content list at the given index.final org.jdom2.ElementaddContent(int index, org.jdom2.Content content) Inserts the child into the content list at the given indexfinal org.jdom2.ElementaddContent(String text) This adds text content to this element.final org.jdom2.ElementaddContent(Collection collection) Appends all children in the given collection to the end of the content list.final org.jdom2.ElementaddContent(org.jdom2.Content content) Appends the child to the end of the element's content listfinal intgetAttributeValueAsInteger(String attributeName) Gets attribute value as integer.final longgetAttributeValueAsLong(String attributeName) Gets attribute value as long.final org.jdom2.ElementsetAttribute(String name, String value) This sets an attribute value for this element.final org.jdom2.ElementsetAttribute(String name, String value, org.jdom2.Namespace ns) This sets an attribute value for this element.final AbstractElementsetAttributeValueAsInteger(String name, int value) Sets attribute value as integer.setAttributeValueAsLong(String name, long value) Sets attribute value as long.org.jdom2.ElementSets the content of the element to be the text given.final StringtoString()final StringMethods inherited from class org.jdom2.Element
addNamespaceDeclaration, canContainContent, clone, cloneContent, coalesceText, detach, getAdditionalNamespaces, getAttribute, getAttribute, getAttributes, getAttributesSize, getAttributeValue, getAttributeValue, getAttributeValue, getAttributeValue, getChild, getChild, getChildren, getChildren, getChildren, getChildText, getChildText, getChildTextNormalize, getChildTextNormalize, getChildTextTrim, getChildTextTrim, getContent, getContent, getContent, getContentSize, getDescendants, getDescendants, getName, getNamespace, getNamespace, getNamespacePrefix, getNamespacesInherited, getNamespacesInScope, getNamespacesIntroduced, getNamespaceURI, getQualifiedName, getText, getTextNormalize, getTextTrim, getValue, getXMLBaseURI, hasAdditionalNamespaces, hasAttributes, indexOf, isAncestor, isRootElement, removeAttribute, removeAttribute, removeAttribute, removeChild, removeChild, removeChildren, removeChildren, removeContent, removeContent, removeContent, removeContent, removeNamespaceDeclaration, setAttribute, setAttributes, setContent, setContent, setContent, setContent, setName, setNamespace, sortAttributes, sortChildren, sortContent, sortContentMethods inherited from class org.jdom2.Content
equals, getCType, getDocument, getParent, getParentElement, hashCode, setParentMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jdom2.Parent
getDocument, getParent
-
Constructor Details
-
AbstractElement
Initializes DOM element.- Parameters:
name- Element name
-
-
Method Details
-
getAttributeValueAsInteger
Gets attribute value as integer.- Parameters:
attributeName- Attribute name- Returns:
- Attribute value as integer or 0 if not set.
-
setAttributeValueAsLong
Sets attribute value as long.- Parameters:
name- Attribute namevalue- Attribute value as long- Returns:
- Self reference
-
getAttributeValueAsLong
Gets attribute value as long.- Parameters:
attributeName- Attribute name- Returns:
- Attribute value as long or 0 if not set.
-
setAttributeValueAsInteger
Sets attribute value as integer.- Parameters:
name- Attribute namevalue- Attribute value as integer- Returns:
- Self reference
-
addContent
public final org.jdom2.Element addContent(org.jdom2.Content content) Appends the child to the end of the element's content list- Specified by:
addContentin interfaceorg.jdom2.Parent- Overrides:
addContentin classorg.jdom2.Element- Parameters:
content- Child to append to end of content list. Null values are ignored.- Returns:
- The element on which the method was called.
-
addContent
public final org.jdom2.Element addContent(int index, org.jdom2.Content content) Inserts the child into the content list at the given index- Specified by:
addContentin interfaceorg.jdom2.Parent- Overrides:
addContentin classorg.jdom2.Element- Parameters:
index- Location for adding the collectioncontent- Child to append to end of content list. Null values are ignored.- Returns:
- The element on which the method was called.
-
addContent
This adds text content to this element. It does not replace the existing content as does setText().- Overrides:
addContentin classorg.jdom2.Element- Parameters:
text- String to add. Null values are ignored.- Returns:
- This element modified
-
addContent
Appends all children in the given collection to the end of the content list. In event of an exception during add the original content will be unchanged and the objects in the supplied collection will be unaltered.- Specified by:
addContentin interfaceorg.jdom2.Parent- Overrides:
addContentin classorg.jdom2.Element- Parameters:
collection- Collection to append. Null values are ignored.- Returns:
- the element on which the method was called
-
addContent
Inserts the content in a collection into the content list at the given index. In event of an exception the original content will be unchanged and the objects in the supplied collection will be unaltered.- Specified by:
addContentin interfaceorg.jdom2.Parent- Overrides:
addContentin classorg.jdom2.Element- Parameters:
index- Location for adding the collectioncollection- Collection to insert. Null values are ignored.- Returns:
- The parent on which the method was called
-
add
Appends the child to the end of the element's content list. Returns not the element itself (contrary to addContent), but a reference to the newly added element.- Type Parameters:
T- Type that extends Element- Parameters:
element- Element to add. Null values are ignored.- Returns:
- The added element.
-
setText
Sets the content of the element to be the text given. All existing text content and non-text context is removed. If this element should have both textual content and nested elements, useinstead. Setting a null text value is equivalent to setting an empty string value.Element.setContent(java.util.Collection<? extends org.jdom2.Content>)- Overrides:
setTextin classorg.jdom2.Element- Parameters:
text- new text content for the element- Returns:
- the target element
- Throws:
org.jdom2.IllegalDataException- if the assigned text contains an illegal character such as a vertical tab (as determined byVerifier.checkCharacterData(java.lang.String))
-
setAttribute
This sets an attribute value for this element. Any existing attribute with the same name and namespace URI is removed.- Overrides:
setAttributein classorg.jdom2.Element- Parameters:
name- name of the attribute to setvalue- value of the attribute to setns- namespace of the attribute to set- Returns:
- this element modified
- Throws:
org.jdom2.IllegalNameException- if the given name is illegal as an attribute name, or if the namespace is an unprefixed default namespaceorg.jdom2.IllegalDataException- if the given attribute value is illegal character data (as determined byVerifier.checkCharacterData(java.lang.String)).org.jdom2.IllegalAddException- if the attribute namespace prefix collides with another namespace prefix on the element.
-
setAttribute
This sets an attribute value for this element. Any existing attribute with the same name and namespace URI is removed.- Overrides:
setAttributein classorg.jdom2.Element- Parameters:
name- name of the attribute to setvalue- value of the attribute to set- Returns:
- this element modified
- Throws:
org.jdom2.IllegalNameException- if the given name is illegal as an attribute name.org.jdom2.IllegalDataException- if the given attribute value is illegal character data (as determined byVerifier.checkCharacterData(java.lang.String)).
-
toString
- Overrides:
toStringin classorg.jdom2.Element
-
toStringContentOnly
- Returns:
- Content of element serialized as string
-