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

Square Root of Integer

Given an integer A. Compute and return the square root of A. If A is…

1 year ago

Build Array From Permutation

Given a zero-based permutation nums (0-indexed), build an array ans of the same length where…

1 year ago

DSA: Heap

A heap is a specialized tree-based data structure that satisfies the heap property. It is…

1 year ago

DSA: Trie

What is a Trie in DSA? A trie, often known as a prefix tree, is…

1 year ago

Trees: Lowest Common Ancestor

What is the Lowest Common Ancestor? In a tree, the lowest common ancestor (LCA) of…

1 year ago

Binary Search Tree (BST)

A Binary Search Tree (BST) is a type of binary tree that satisfies the following…

1 year ago