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