public interface FunctionAnnotationHandler
|Modifier and Type||Method and Description|
Test whether a given set of annotations in this namespace is valid.
Get the namespace handled by this function annotation handler.
Test the relationship of one list of annotation assertions to another list of annotation assertions, all from this namespace.
Test whether a function with a given list of annotations satisfies an annotation assertion present on a function item test.
void check(AnnotationList annotations, java.lang.String construct) throws XPathException
annotations- the annotation list (filtered by namespace: all the annotations will have names in the namespace for this annotation handler)
construct- the construct on which this list of annotations appears. One of "DF" (declare function), "DV" (declare variable), "IF" (inline function), "FT" (function test)
XPathException- if the annotation is invalid, or if it is inconsistent with the annotations in the existing list.
boolean satisfiesAssertion(Annotation assertion, AnnotationList annotationList)
assertion- the annotation assertion present in the function item test
annotationList- the annotations present on the function being tested, filtered by namespace
Affinity relationship(AnnotationList firstList, AnnotationList secondList)
The lists will always be non-empty, because it is assumed that a test with an empty list of assertions always subsumes a test with a non-empty list.
firstList- the first list of annotation assertions
secondList- the second list of annotation assertions
Affinity.SUBSUMED_BY. For example, if the first list is
%colour("blue")and the second list is
%colour("green"), and no function can be both blue and green, then return
DISJOINT. But if a function can have more than one colour, return
OVERLAPSbecause the set of functions conforming to the two assertions has a non-empty intersection. If the first list is
%colour("any")and the second list is
%colour("blue"), then return
SUBSUMES, because the set of functions satisfying the first assertion is a superset of those satisfying the second assertion.
The result of this method must be consistent with the
satisfiesAssertion(Annotation, AnnotationList) method.
For example, if this method indicates that
%huge, then it must indeed
be the case that the set of functions that satisfy the assertion
%big is a superset of those that
satisfy the assertion
If in doubt, it is always safe to return
OVERLAPS: the worst that can happen is that type-checking is deferred
Copyright (c) 2004-2021 Saxonica Limited. All rights reserved.