Package org.camunda.spin.impl.xml.dom
Class DomXmlAttribute
- java.lang.Object
-
- org.camunda.spin.Spin<T>
-
- org.camunda.spin.xml.SpinXmlNode<SpinXmlAttribute>
-
- org.camunda.spin.xml.SpinXmlAttribute
-
- org.camunda.spin.impl.xml.dom.DomXmlAttribute
-
public class DomXmlAttribute extends SpinXmlAttribute
Wrapper of a xml dom attribute.- Author:
- Sebastian Menski
-
-
Field Summary
Fields Modifier and Type Field Description protected org.w3c.dom.AttrattributeNodeprotected DomXmlDataFormatdataFormat
-
Constructor Summary
Constructors Constructor Description DomXmlAttribute(org.w3c.dom.Attr attributeNode, DomXmlDataFormat dataFormat)Create a new wrapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDataFormatName()Provides the name of the dataformat used by this spin.booleanhasNamespace(java.lang.String namespace)Checks if the node has a given namespace.booleanhasPrefix(java.lang.String prefix)Checks if the node has a given prefix.<C> CmapTo(java.lang.Class<C> javaClass)Maps XML into specific class<C> CmapTo(java.lang.String javaClass)Maps Xml into specific classjava.lang.Stringname()Returns the local name of the node without namespace or prefix.java.lang.Stringnamespace()Returns the namespace uri of the node and not the prefix.java.lang.Stringprefix()Returns the prefix of the node and not the namespace uri.SpinXmlElementremove()Removes the attribute.java.lang.StringtoString()Returns the wrapped XML attribute value as string representation.org.w3c.dom.Attrunwrap()Return the wrapped object.java.lang.Stringvalue()Returns the value of the attribute asString.SpinXmlAttributevalue(java.lang.String value)Sets the value of the attribute.voidwriteToWriter(java.io.Writer writer)Writes the wrapped XML attribute value to an existing writer.
-
-
-
Field Detail
-
attributeNode
protected final org.w3c.dom.Attr attributeNode
-
dataFormat
protected final DomXmlDataFormat dataFormat
-
-
Constructor Detail
-
DomXmlAttribute
public DomXmlAttribute(org.w3c.dom.Attr attributeNode, DomXmlDataFormat dataFormat)Create a new wrapper.- Parameters:
attributeNode- the dom xml attribute to wrapdataFormat- the xml dom data format
-
-
Method Detail
-
getDataFormatName
public java.lang.String getDataFormatName()
Description copied from class:SpinProvides the name of the dataformat used by this spin.- Specified by:
getDataFormatNamein classSpin<SpinXmlAttribute>- Returns:
- the name of the dataformat used by this Spin.
-
unwrap
public org.w3c.dom.Attr unwrap()
Description copied from class:SpinReturn the wrapped object. The return type of this method depends on the concrete data format.- Specified by:
unwrapin classSpin<SpinXmlAttribute>- Returns:
- the object wrapped by this wrapper.
-
name
public java.lang.String name()
Description copied from class:SpinXmlNodeReturns the local name of the node without namespace or prefix.- Specified by:
namein classSpinXmlNode<SpinXmlAttribute>- Returns:
- the name of the node
-
namespace
public java.lang.String namespace()
Description copied from class:SpinXmlNodeReturns the namespace uri of the node and not the prefix.- Specified by:
namespacein classSpinXmlNode<SpinXmlAttribute>- Returns:
- the namespace of the node
-
prefix
public java.lang.String prefix()
Description copied from class:SpinXmlNodeReturns the prefix of the node and not the namespace uri.- Specified by:
prefixin classSpinXmlNode<SpinXmlAttribute>- Returns:
- the prefix of the node
-
hasPrefix
public boolean hasPrefix(java.lang.String prefix)
Description copied from class:SpinXmlNodeChecks if the node has a given prefix.- Specified by:
hasPrefixin classSpinXmlNode<SpinXmlAttribute>- Parameters:
prefix- the prefix to check- Returns:
- true if the name has the same prefix
-
hasNamespace
public boolean hasNamespace(java.lang.String namespace)
Description copied from class:SpinXmlNodeChecks if the node has a given namespace.- Specified by:
hasNamespacein classSpinXmlNode<SpinXmlAttribute>- Parameters:
namespace- the namespace to check- Returns:
- true if the node has the same namespace
-
value
public java.lang.String value()
Description copied from class:SpinXmlAttributeReturns the value of the attribute asString.- Specified by:
valuein classSpinXmlAttribute- Returns:
- the string value of the attribute
-
value
public SpinXmlAttribute value(java.lang.String value)
Description copied from class:SpinXmlAttributeSets the value of the attribute.- Specified by:
valuein classSpinXmlAttribute- Parameters:
value- the value to set- Returns:
- the wrapped xml dom attribute
-
remove
public SpinXmlElement remove()
Description copied from class:SpinXmlAttributeRemoves the attribute.- Specified by:
removein classSpinXmlAttribute- Returns:
- the wrapped owner
tree element
-
toString
public java.lang.String toString()
Description copied from class:SpinXmlAttributeReturns the wrapped XML attribute value as string representation.- Specified by:
toStringin classSpinXmlAttribute- Returns:
- the string representation
-
writeToWriter
public void writeToWriter(java.io.Writer writer)
Description copied from class:SpinXmlAttributeWrites the wrapped XML attribute value to an existing writer.- Specified by:
writeToWriterin classSpinXmlAttribute- Parameters:
writer- the writer to write to
-
mapTo
public <C> C mapTo(java.lang.Class<C> javaClass)
Description copied from class:SpinXmlNodeMaps XML into specific class- Specified by:
mapToin classSpinXmlNode<SpinXmlAttribute>- Parameters:
javaClass- Class to which the Xml should be mapped- Returns:
- mapped Class
-
mapTo
public <C> C mapTo(java.lang.String javaClass)
Description copied from class:SpinXmlNodeMaps Xml into specific class- Specified by:
mapToin classSpinXmlNode<SpinXmlAttribute>- Parameters:
javaClass- canonical name of the class- Returns:
- mapped class
-
-