Metadata Selector (.^someMetadata)

Metadata Selector (.^someMetadata)

Returns the value of specified metadata for a Mule payload, variable, or attribute. The selector can return the following metadata:

  • Content length metadata: .^contentLength returns the content length of the value, if the value is present. For an example, see Content Length Metadata Selector (.^contentLength).
  • Class metadata: .^class returns the class of the Plain Old Java Object (POJO). For example, { “string” : payload.string.^class } might return { “string”: “java.lang.String” } if the input payload defines a Java string, such as simplePojo.string = “myString”, in a simple POJO, and { “date” : payload.date.^class } might return { “date”: “java.util.Date” }. For an example, see Class Metadata Selector (.^class).
  • Encoding metadata: .^encoding returns the encoding of a value. For example, { “myEncoding” : payload.^encoding } might return {“myEncoding”: “UTF-8”} for an input POJO. For an example, see Encoding Metadata Selector (.^encoding).
  • Media Type Selector: .^mediaType returns the MIME type of a value that includes parameters, for example, application/json;charset=UTF-16, and the expression in the value of { “myMediaType” : payload.^mediaType } might return “myMediaType”: “/; charset=UTF-8″ for an input POJO. For an example, see Media Type Metadata Selector (.^mediaType).
  • MIME Type metadata: .^mimeType returns the MIME type (without parameters) of a value, for example, application/json, and { “myMimeType” : payload.^mimeType } might return { “myMediaType”: “/” } for an input POJO. For an example, see MIME Type Metadata Selector (.^mimeType).
  • Raw metadata: .^raw returns the underlying data (typically, a binary value) of a plain old Java object (POJO). This selector is sometimes used when calculating an MD5 for hashes when checking for man-in-the-middle attacks. For examples, see Raw Metadata Selector (.^raw).

Custom metadata: .^myCustomMetadata returns the value of custom metadata. For examples, see Custom Metadata Selector (.^myCustomMetadata).

Follow Me

If you like my post please follow me to read my latest post on programming and technology.

Instagram

Facebook

Recent Posts

Find Intersection of Two Singly Linked Lists

You are given two singly linked lists that intersect at some node. Your task is…

4 months ago

Minimum Cost to Paint Houses with K Colors

A builder plans to construct N houses in a row, where each house can be…

4 months ago

Longest Absolute Path in File System Representation

Find the length of the longest absolute path to a file within the abstracted file…

4 months ago

Efficient Order Log Storage

You manage an e-commerce website and need to keep track of the last N order…

5 months ago

Select a Random Element from a Stream

You are given a stream of elements that is too large to fit into memory.…

5 months ago

Estimate π Using Monte Carlo Method

The formula for the area of a circle is given by πr². Use the Monte…

5 months ago