Class AnnotationList

java.lang.Object
net.sf.saxon.query.AnnotationList
All Implemented Interfaces:
Iterable<Annotation>

public class AnnotationList extends Object implements Iterable<Annotation>
An immutable list of function or variable annotations, or of annotation assertions
  • Field Details

  • Constructor Details

  • Method Details

    • singleton

      public static AnnotationList singleton(Annotation ann)
      Construct an annotation list containing a single annotation
      Parameters:
      ann - the single annotation in the annotation list
      Returns:
      a singleton annotation list
    • check

      public void check(Configuration config, String where) throws XPathException
      Check an annotation list for internal consistency (e.g. rules that %public and %private cannot coexist)
      Parameters:
      config - the Saxon configuration
      where - the context where the list appears: one of "DF" (declare function), "DV" (declare variable), "IF" (inline function declaration), "FT" (function test), "DI" (declare item-type)
      Throws:
      XPathException - if the annotation list is not internally consistent
    • filterByNamespace

      public AnnotationList filterByNamespace(NamespaceUri ns)
      Filter the annotation list by the namespace URI part of the annotation name
      Parameters:
      ns - the namespace URI required
      Returns:
      an annotation list containing the subset of this annotation list where the annotation names have the required namespace
    • iterator

      public Iterator<Annotation> iterator()
      Returns an iterator over a set of elements of type T.
      Specified by:
      iterator in interface Iterable<Annotation>
      Returns:
      an Iterator.
    • isEmpty

      public boolean isEmpty()
      Ask whether the list of annotations is empty
      Returns:
      true if the list of annotations is empty
    • size

      public int size()
      The number of annotations in the list
      Returns:
      the number of annotations in the list of annotations
    • get

      public Annotation get(int i)
      Get the i'th annotation in the list (counting from zero)
      Parameters:
      i - the index of the required annotation (counting from zero)
      Returns:
      the annotation at the specified position
    • includes

      public boolean includes(StructuredQName name)
      Ask whether a list of annotations contains an annotation with a given name
      Parameters:
      name - the given name
      Returns:
      true if one or more annotations with the given name are present in the list
    • includes

      public boolean includes(String localName)
      Ask whether a list of annotations contains an annotation with a given local name
      Parameters:
      localName - the given local name
      Returns:
      true if one or more annotations with the given name are present in the list
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object