Class AttributeAxisIterator

java.lang.Object
net.sourceforge.pmd.lang.rule.xpath.impl.AttributeAxisIterator
All Implemented Interfaces:
Iterator<Attribute>

public class AttributeAxisIterator extends Object implements Iterator<Attribute>
Explores an AST node reflectively to iterate over its XPath attributes. This is the default way the attributes of a node are made accessible to XPath rules, and defines an important piece of PMD's XPath support.
See Also:
  • Constructor Details

    • AttributeAxisIterator

      public AttributeAxisIterator(@NonNull Node contextNode)
      Creates a new iterator that enumerates the attributes of the given node. Note: if you want to access the attributes of a node, don't use this directly, use instead the overridable Node.getXPathAttributesIterator().
  • Method Details

    • isAttributeAccessor

      protected boolean isAttributeAccessor(Class<?> nodeClass, Method method)
      Returns whether the given method is an attribute accessor, in which case a corresponding Attribute will be added to the iterator.
      Parameters:
      method - The method to test
    • next

      public Attribute next()
      Specified by:
      next in interface Iterator<Attribute>
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<Attribute>