Nav
You are viewing an older version of this topic. To go to a different version, use the version menu at the upper-right. +

@Function Annotation

A parameter injection annotation expression on the message payload with the result being passed into the method, this annotation exposes a common set of functions used in Mule such as a counter, UUID generator, date and timestamps.


         
      
1
2
3
4
5
6
public class MyComponent {
    public Object process(@XPath("/Envelope") Document doc
                                        @Function("uuid") String id) {
        // do stuff
    }
}

Functions

Function Description

@Function("now")

Returns a java.sql.Timestamp with the current time

@Function("date")

Returns a java.util.Date with the current time

@Function("dateStamp")

Returns a java.lang.String that contains the current date formatted according as\{\{ dd-MM-yy_HH-mm-ss.SSS }}

@Function("dateStamp-dd-MM-yyyy")

Returns a java.lang.String that contains the current date formatted according as\{{dd-MM-yyyy}}

@Function("uuid")

Returns a globally unique identifier as a java.lang.String

@Function("hostname")

Returns the hostname of the machine Mule is running on as a java.lang.String

@Function("ip")

Returns the IP address of the machine Mule is running on as a java.lang.String

@Function("count")

Returns a local count as a java.lang.Long that will increment for each call. If the server is restarted, the counter will return to zero

@Function("payloadClass")

Returns the fully qualified class name of the payload as a java.lang.String

@Function("shortPayloadClass")

Returns just the class name of the payload as a java.lang.String

In this topic:

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.

+