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.expressions;
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 evaluator allows for predefined functions
19 * to be called and returns a result. The functions it supports are:
20 * <ul>
21 * <li>now - Returns a {@link java.sql.Timestamp} with the current time.</li>
22 * <li>date - Returns a {@link java.util.Date} with the current time.</li>
23 * <li>dateStamp - Returns a {@link java.lang.String} that contains the current date formatted according to {@link org.mule.expression.FunctionExpressionEvaluator#DEFAULT_DATE_FORMAT}.</li>
24 * <li>dateStamp-dd-MM-yyyy - Returns a {@link java.lang.String} that contains the current date formatted according to the format passed into the function.</li>
25 * <li>uuid - Returns a globally unique identifier</li>
26 * <li>hostname - Returns the hostname of the machine Mule is running on</li>
27 * <li>ip - Returns the IP address of the machine Mule is running on</li>
28 * <li>count - Returns a local count that will increment for each call. If the server is restarted, the counter will return to zero.</li>
29 * <li>payloadClass - Returns a fuly qualified class name of the payload as a string.</li>
30 * <li>shortPayloadClass - Returns just the class name of the payload as a string.</li>
31 * </ul>
32 */
33 @Target(ElementType.PARAMETER)
34 @Retention(RetentionPolicy.RUNTIME)
35 @Documented
36 @Evaluator("function")
37 public @interface Function
38 {
39 /**
40 * @return the function expression to execute
41 */
42 String value();
43 }