Contact Us 1-800-596-4880

Core Annotations (dw::Core)

Annotation Definition Description

AnnotationTarget

@AnnotationTarget(targets: Array<"Function" | "Parameter" | "Variable" | "Import">)

Annotation that limits the scope of an annotation. For example, the Lazy annotation applies only to variables, and the StreamCapable annotation applies only to parameters and variables. If no AnnotationTarget is specified, an annotation can apply to any valid target. An example is @AnnotationTarget(targets = ["Function", "Variable"]) to limit the scope of the annotation annotation TailRec().

Annotation Targets:

  • Parameter: For function parameters.

  • Function: For function definitions.

  • Variable: For variable definitions.

  • Import: For import definitions.

Deprecated

@Deprecated(since: String, replacement: String)

Annotation that marks a function as deprecated.

Introduced in DataWeave version 2.4.0.

DesignOnlyType

@DesignOnlyType()

Annotation that marks a parameter type as design only to indicate that the field type is validated only at design time. At runtime, only minimal type validation takes place. This annotation is useful for performance, especially with complex Object types.

Experimental

@Experimental()

Annotation that marks a function as experimental and subject to change or removal in the future.

Introduced in DataWeave version 2.4.0.

GlobalDescription

@GlobalDescription()

Annotation used to identify which functions gets the function description from the function’s documentation section. This annotation is useful for selecting the correct function description when the function is overloaded.

Introduced in DataWeave version 2.4.0.

Interceptor

@Interceptor(interceptorFunction: String | (annotationArgs: Object, targetFunctionName: String, args: Array<Any>, callback: (args: Array<Any>) -> Any) -> Any)

Annotation that marks another annotation as an Interceptor so that the marked annotation will wrap an annotated function with an interceptorFunction. An example is the RuntimePrivilege annotation, which is annotated by @Interceptor(interceptorFunction = "@native system::SecurityManagerCheckFunctionValue"). The readUrl function definition is annotated by @RuntimePrivilege(requires = "Resource").

Experimental: This experimental feature is subject to change or removal from future versions of DataWeave.

Internal

@Internal(permits: Array<String>)

Annotation that marks a function as internal and not to be used.

Introduced in DataWeave 2.4.0.

Experimental: This experimental feature is subject to change or removal from future versions of DataWeave.

Labels

@Labels(labels: Array<String>)

Annotation for labeling a function or variable so that the labelled target becomes more easy to discover. An example is @Labels(labels = ["foreach", "transform"]), which annotates definitions of map and mapObject functions.

Introduced in DataWeave version 2.4.0.

Lazy

@Lazy()

Annotation that marks a variable declaration for lazy initialization.

Introduced in DataWeave version 2.3.0.

RuntimePrivilege

@RuntimePrivilege(requires: String)

Annotation used to indicate that a function requires runtime privileges to execute. An example is @RuntimePrivilege(requires = "Resource"), which annotates the readUrl function definition.

Since

@Since(version: String)

Annotation that identifies the DataWeave version in which the annotated functionality was introduced. An example is @Since(version = "2.4.0").

Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.

StreamCapable

@StreamCapable()

Annotation that marks a parameter as stream capable, which means that the annotated field consumes an array of objects in a forward-only manner. Examples of functions with @StreamCapable fields are map, mapObject, and pluck.

TailRec

@TailRec()

Annotation that marks a function as tail recursive. If a function with this annotation is not tail recursive, the function will fail.

UntrustedCode

@UntrustedCode()

Annotation that marks a script as untrusted, which means that the script has no privileges. For example, the script cannot gain access to environment variables or read a resource from a URL.

Experimental: This experimental feature is subject to change or removal from future versions of DataWeave.