/** * Construct an annotation list containing a single annotation * @param ann the single annotation in the annotation list * @return a singleton annotation list */ public static AnnotationList singleton(Annotation ann) { return new AnnotationList(Collections.singletonList(ann)); }
/** * Construct an annotation list containing a single annotation * @param ann the single annotation in the annotation list * @return a singleton annotation list */ public static AnnotationList singleton(Annotation ann) { return new AnnotationList(Collections.singletonList(ann)); }
/** * Filter the annotation list by the namespace URI part of the annotation name * @param ns the namespace URI required * @return an annotation list containing the subset of this annotation list where the * annotation names have the required namespace */ public AnnotationList filterByNamespace(String ns) { List<Annotation> out = new ArrayList<>(); for (Annotation ann : list) { if (ann.getAnnotationQName().hasURI(ns)) { out.add(ann); } } return new AnnotationList(out); }
/** * Filter the annotation list by the namespace URI part of the annotation name * @param ns the namespace URI required * @return an annotation list containing the subset of this annotation list where the * annotation names have the required namespace */ public AnnotationList filterByNamespace(String ns) { List<Annotation> out = new ArrayList<>(); for (Annotation ann : list) { if (ann.getAnnotationQName().hasURI(ns)) { out.add(ann); } } return new AnnotationList(out); }
/** * Check an annotation list for internal consistency (e.g. rules that %public and %private cannot coexist) * @param 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 */ public void check(Configuration config, String where) throws XPathException { Map<String, List<Annotation>> map = groupByNamespace(); for (Map.Entry<String, List<Annotation>> entry : map.entrySet()) { FunctionAnnotationHandler handler = config.getFunctionAnnotationHandler(entry.getKey()); if (handler != null) { handler.check(new AnnotationList(entry.getValue()), where); } } }
/** * Check an annotation list for internal consistency (e.g. rules that %public and %private cannot coexist) * @param 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 */ public void check(Configuration config, String where) throws XPathException { Map<String, List<Annotation>> map = groupByNamespace(); for (Map.Entry<String, List<Annotation>> entry : map.entrySet()) { FunctionAnnotationHandler handler = config.getFunctionAnnotationHandler(entry.getKey()); if (handler != null) { handler.check(new AnnotationList(entry.getValue()), where); } } }
return new AnnotationList(annotations);
annotations.add(new Annotation(new StructuredQName("saxon", NamespaceConstant.SAXON, "memo-function"))); fn.setAnnotations(new AnnotationList(annotations)); compiledFunction = fn; } catch (XPathException err) {
return new AnnotationList(annotations);
annotations.add(new Annotation(new StructuredQName("saxon", NamespaceConstant.SAXON, "memo-function"))); fn.setAnnotations(new AnnotationList(annotations)); compiledFunction = fn; } catch (XPathException err) {