Annotation Type OperatorContext.ContextCheck
-
@Documented @Retention(value=RUNTIME) @Target(value=METHOD) public static @interface OperatorContext.ContextCheck
A method annotated@ContextCheck
allows checking of an operator's invocation context. Annotated methods can be executed during SPL compilation and at runtime beforeOperator.initialize(OperatorContext)
is called.Annotated methods are searched for in the operator's Java class (which must be an instance of
Operator
) and all of its super classes. Order of invocation of annotated methods is not defined.
The annotated method must bepublic
,static
and have a single parameter of typeOperatorContextChecker
. Any other method annotated with@ContextCheck
will be ignored.
At runtime@ContextCheck
methods are invoked before invocation of@Parameter
annotated methods.Here's an example where if the optional parameter
user
is set then the optional parameterpassword
must also be set.@ContextCheck public static void checkUserPassword(OperatorContextChecker checker) { checker.checkDependentParameters("user", "password"); }
Any exception thrown during the method's invocation causes compilation or runtime invocation to fail.
Compile time checking using
@ContextCheck
is only supported by the SPL compiler for Java primitive operators. Invocation of anOperator
using the SPL standard toolkit operatorspl.utility.JavaOp
will not invoke methods annotated with@ContextCheck
.- See Also:
OperatorContextChecker
-
-
Element Detail
-
compile
public abstract boolean compile
Check at compile time.- Returns:
- True to invoke method at SPL compile time, false to not execute at SPL compile time.
- Default:
- true
-
runtime
public abstract boolean runtime
Check at runtime.- Returns:
- True to invoke method at runtime, false to not execute at runtime.
- Default:
- true
-
-