Class AnnotationList

  • All Implemented Interfaces:
    java.lang.Iterable<Annotation>

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

      Fields 
      Modifier and Type Field Description
      static AnnotationList EMPTY
      An empty annotation list
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void check​(Configuration config, java.lang.String where)
      Check an annotation list for internal consistency (e.g.
      boolean equals​(java.lang.Object other)  
      AnnotationList filterByNamespace​(java.lang.String ns)
      Filter the annotation list by the namespace URI part of the annotation name
      Annotation get​(int i)
      Get the i'th annotation in the list (counting from zero)
      int hashCode()  
      boolean includes​(java.lang.String localName)
      Ask whether a list of annotations contains an annotation with a given local name
      boolean includes​(StructuredQName name)
      Ask whether a list of annotations contains an annotation with a given name
      boolean isEmpty()
      Ask whether the list of annotations is empty
      java.util.Iterator<Annotation> iterator()
      Returns an iterator over a set of elements of type T.
      static AnnotationList singleton​(Annotation ann)
      Construct an annotation list containing a single annotation
      int size()
      The number of annotations in the list
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

    • Constructor Detail

      • AnnotationList

        public AnnotationList​(java.util.List<Annotation> list)
    • Method Detail

      • 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,
                          java.lang.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)
        Throws:
        XPathException - if the annotation list is not internally consistent
      • filterByNamespace

        public AnnotationList filterByNamespace​(java.lang.String 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 java.util.Iterator<Annotation> iterator()
        Returns an iterator over a set of elements of type T.
        Specified by:
        iterator in interface java.lang.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​(java.lang.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​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object