1 /*
2 * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
3 * The software in this package is published under the terms of the CPAL v1.0
4 * license, a copy of which has been included with this distribution in the
5 * LICENSE.txt file.
6 */
7 package org.mule.api.annotations.expression;
8
9 import org.mule.api.annotations.meta.Evaluator;
10
11 import java.lang.annotation.Documented;
12 import java.lang.annotation.ElementType;
13 import java.lang.annotation.Retention;
14 import java.lang.annotation.RetentionPolicy;
15 import java.lang.annotation.Target;
16
17 /**
18 * This allows Groovy codes to be executed on the current message.
19 *
20 * Mule will bind a number of objects to the groovy context:
21 *
22 * <ul>
23 * <li>muleContext - A reference to the MuleContext object.</li>
24 * <li>eventContext - A reference to the event context. This allows you to dispatch events progammatically from your script.</li>
25 * <li>message - The current message.</li>
26 * <li>payload - The payload of the current message. This is just a shortcut to $message.payload.</li>
27 * <li>service - A reference to the current service object.</li>
28 * <li>id - The current event ID. This is a UUID created for events in Mule.</li>
29 * <li>log - A logger that can be used to write to Mule's log file.</li>
30 * </ul>
31 */
32 @Target(ElementType.PARAMETER)
33 @Retention(RetentionPolicy.RUNTIME)
34 @Documented
35 @Evaluator("groovy")
36 public @interface Groovy
37 {
38 String value();
39
40 boolean optional() default false;
41
42 }