View Javadoc

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