Contact Us 1-800-596-4880

@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.

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