Class AttributeNode

java.lang.Object
com.puppycrawl.tools.checkstyle.xpath.AbstractNode
com.puppycrawl.tools.checkstyle.xpath.AttributeNode
All Implemented Interfaces:
Source, SourceLocator, net.sf.saxon.lib.ActiveSource, net.sf.saxon.om.GroundedValue, net.sf.saxon.om.Item, net.sf.saxon.om.NodeInfo, net.sf.saxon.om.Sequence, net.sf.saxon.s9api.Location, Locator

public class AttributeNode extends AbstractNode
Represents attribute of the element.
  • Field Details

    • name

      private final String name
      The name of the attribute.
    • value

      private final String value
      The value of the attribute.
  • Constructor Details

    • AttributeNode

      public AttributeNode(String name, String value)
      Creates a new AttributeNode instance.
      Parameters:
      name - name of the attribute
      value - value of the attribute
  • Method Details

    • compareOrder

      public int compareOrder(net.sf.saxon.om.NodeInfo nodeInfo)
      Compares current object with specified for order. Throws UnsupportedOperationException because functionality not required here.
      Parameters:
      nodeInfo - another NodeInfo object
      Returns:
      number representing order of current object to specified one
    • getAttributeValue

      public String getAttributeValue(net.sf.saxon.om.NamespaceUri namespace, String localPart)
      Returns attribute value. Throws UnsupportedOperationException because attribute node has no attributes.
      Parameters:
      namespace - namespace
      localPart - actual name of the attribute
      Returns:
      attribute value
    • getLocalPart

      public String getLocalPart()
      Returns local part.
      Returns:
      local part
    • getNodeKind

      public int getNodeKind()
      Returns type of the node.
      Returns:
      node kind
    • getParent

      public net.sf.saxon.om.NodeInfo getParent()
      Returns parent. Never called for attribute node, throws UnsupportedOperationException. has no attributes.
      Returns:
      parent
    • getRoot

      public net.sf.saxon.om.NodeInfo getRoot()
      Returns root. Never called for attribute node, throws UnsupportedOperationException.
      Returns:
      root
    • getStringValue

      Returns string value.
      Specified by:
      getStringValue in interface net.sf.saxon.om.GroundedValue
      Specified by:
      getStringValue in interface net.sf.saxon.om.Item
      Overrides:
      getStringValue in class AbstractNode
      Returns:
      string value
    • iterateAxis

      public net.sf.saxon.tree.iter.AxisIterator iterateAxis(int axisNumber)
      Determines axis iteration algorithm. Attribute node can not be iterated, throws UnsupportedOperationException.
      Parameters:
      axisNumber - element from AxisInfo
      Returns:
      AxisIterator object
    • getLineNumber

      public int getLineNumber()
      Returns line number. Attribute node has no line number, throws UnsupportedOperationException.
      Returns:
      line number
    • getColumnNumber

      public int getColumnNumber()
      Returns column number. Attribute node has no column number, throws UnsupportedOperationException.
      Returns:
      column number
    • getTokenType

      public int getTokenType()
      Getter method for token type. Attribute node has no token type, throws UnsupportedOperationException.
      Specified by:
      getTokenType in class AbstractNode
      Returns:
      token type
    • getUnderlyingNode

      Returns underlying node. Attribute node has no underlying node, throws UnsupportedOperationException.
      Specified by:
      getUnderlyingNode in class AbstractNode
      Returns:
      underlying node
    • getDepth

      public int getDepth()
      Getter method for node depth. This method is not applicable to attribute nodes, throws unsupported exception.
      Specified by:
      getDepth in class AbstractNode
      Returns:
      never
    • createChildren

      Creates nodes for children. Attribute node has no children, so this method throws unsupported exception.
      Specified by:
      createChildren in class AbstractNode
      Returns:
      never
    • hasChildNodes

      public boolean hasChildNodes()
      Determine whether the node has any children.
      Returns:
      always false
    • throwUnsupportedOperationException

      Returns UnsupportedOperationException exception.
      Returns:
      UnsupportedOperationException exception