Package org.rumbledb.compiler.utils
Class AnnotationValidator
java.lang.Object
org.rumbledb.compiler.utils.AnnotationValidator
Static validation and resolution of annotations on function declarations, variable declarations,
and inline function expressions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckAssignable(List<Annotation> annotations, boolean defaultAssignable, ExceptionMetadata exceptionMetadata) Checks assignable annotations for exclusivity and returns whether the declaration is assignable.static voidvalidateAnnotationName(Name annotationName, ExceptionMetadata metadata) Validates an annotation name against reserved namespaces according to W3C XQuery 3.1 §4.17/§4.18 [err:XQST0045].static voidvalidateFunctionAnnotations(List<Annotation> annotations) Validates annotations on a function declaration according to W3C XQuery 3.1 §4.18 [err:XQST0106].static voidvalidateInlineFunctionAnnotations(List<Annotation> annotations) Validates annotations on an inline function expression according to W3C XQuery 3.1 §3.1.7 [err:XQST0125].static voidvalidateVariableAnnotations(List<Annotation> annotations) Validates annotations on a variable declaration according to W3C XQuery 3.1 §4.17 [err:XQST0116].
-
Method Details
-
validateAnnotationName
Validates an annotation name against reserved namespaces according to W3C XQuery 3.1 §4.17/§4.18 [err:XQST0045].- Parameters:
annotationName- the annotation name to validatemetadata- the source location metadata
-
checkAssignable
public static boolean checkAssignable(List<Annotation> annotations, boolean defaultAssignable, ExceptionMetadata exceptionMetadata) Checks assignable annotations for exclusivity and returns whether the declaration is assignable.- Parameters:
annotations- the list of annotationsdefaultAssignable- default assignable state if not specifiedexceptionMetadata- the source location metadata- Returns:
- true if assignable, false otherwise
-
validateFunctionAnnotations
Validates annotations on a function declaration according to W3C XQuery 3.1 §4.18 [err:XQST0106]. A function declaration cannot contain more than one visibility annotation (%public, %private).- Parameters:
annotations- the list of annotations
-
validateVariableAnnotations
Validates annotations on a variable declaration according to W3C XQuery 3.1 §4.17 [err:XQST0116]. A variable declaration cannot contain more than one visibility annotation (%public, %private).- Parameters:
annotations- the list of annotations
-
validateInlineFunctionAnnotations
Validates annotations on an inline function expression according to W3C XQuery 3.1 §3.1.7 [err:XQST0125].- Parameters:
annotations- the list of annotations
-