---
title: "Metadata"
description: "Metadata"
url: "https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/android/reference/metadata"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-11-17"
---

# Metadata

## Metadata

A Metadata describes one reference that embeds an entry or asset in a JSON Rich Text Editor (JSON RTE) field. It holds seven values, such as the item UID and the display style. Use this class to

*   pass the details of an embedded item to [DefaultOption renderOptions](/docs/developers/sdks/content-delivery-sdk/android/reference/defaultoption#defaultoption-renderoptions)
*   read the UID and display style of an embedded item

SDKUtil.jsonToHTML builds one Metadata for each reference node in a JSON RTE field. To call renderOptions yourself, create one with the public constructor, which takes the seven arguments below:

Name

Type

Description

text

String

Text of the reference.

itemType

String

Type of the embedded item, for example entry or asset.

itemUid

String

UID of the embedded entry or asset.

contentTypeUid

String

Content type UID of the embedded item.

styleType

String

Display style: block, inline, link, display or download, in any letter case.

outerHTML

String

Outer HTML of the reference.

attributes

Attributes

Extra attributes, as a java.util.jar.Attributes map.

## getAttributes

getAttributes returns the attributes stored for the embedded item.

```
Returns: Attributes. The attributes of the embedded item.
ValidationThere is no client-side validation, and getAttributes does not throw.BehaviorClient-side only. getAttributes returns a value stored in the object and makes no request.The value is the attributes argument of the constructor, a java.util.jar.Attributes map.Inside SDKUtil.jsonToHTML, the SDK always passes a new, empty Attributes. It does not copy the attrs of the reference node into it.ExampleBasic usage: count the attributesimport android.util.Log;

import com.contentstack.sdk.Metadata;

import java.util.jar.Attributes;

Metadata metadata = new Metadata("Jane Doe", "entry", "<ENTRY_UID>", "<CONTENT_TYPE_UID>",
        "INLINE", "", new Attributes());
Attributes attributes = metadata.getAttributes();
Log.d("Contentstack", "Attributes: " + attributes.size()); // Attributes: 0
```

## getContentTypeUid

getContentTypeUid returns the content type UID of the embedded item.

```
Returns: String. The content type UID of the embedded item.
ValidationThere is no client-side validation, and getContentTypeUid does not throw.BehaviorClient-side only. getContentTypeUid returns a value stored in the object and makes no request.The value is the contentTypeUid argument of the constructor.Inside SDKUtil.jsonToHTML, the SDK passes the content-type-uid attribute for an embedded entry, and the fixed string asset for an embedded asset. See How the SDK fills a Metadata on the Metadata class page.ExampleBasic usage: read the content type of the embedded itemimport android.util.Log;

import com.contentstack.sdk.Metadata;

import java.util.jar.Attributes;

Metadata metadata = new Metadata("Jane Doe", "entry", "<ENTRY_UID>", "<CONTENT_TYPE_UID>",
        "INLINE", "", new Attributes());
Log.d("Contentstack", "Content type: " + metadata.getContentTypeUid());
```

## getItemType

getItemType returns whether the embedded item is an entry or an asset.

```
Returns: String. The type of the embedded item.
ValidationThere is no client-side validation, and getItemType does not throw.BehaviorClient-side only. getItemType returns a value stored in the object and makes no request.The value is the itemType argument of the constructor.Inside SDKUtil.jsonToHTML, the SDK passes the type attribute of the reference node, for example entry or asset. See How the SDK fills a Metadata on the Metadata class page.ExampleBasic usage: check whether the item is an assetimport android.util.Log;

import com.contentstack.sdk.Metadata;

import java.util.jar.Attributes;

Metadata metadata = new Metadata("Jane Doe", "entry", "<ENTRY_UID>", "<CONTENT_TYPE_UID>",
        "INLINE", "", new Attributes());
if ("asset".equals(metadata.getItemType())) {
    Log.d("Contentstack", "The reference embeds an asset");
} else {
    Log.d("Contentstack", "The reference embeds an entry");
}
```

## getItemUid

getItemUid returns the UID of the embedded entry or asset.

```
Returns: String. The UID of the embedded item.
ValidationThere is no client-side validation, and getItemUid does not throw.BehaviorClient-side only. getItemUid returns a value stored in the object and makes no request.The value is the itemUid argument of the constructor.Inside SDKUtil.jsonToHTML, the SDK reads the value from the entry-uid attribute for an embedded entry. For an embedded asset, it reads the asset-uid attribute. See How the SDK fills a Metadata on the Metadata class page.ExampleBasic usage: read the UID of the embedded itemimport android.util.Log;

import com.contentstack.sdk.Metadata;

import java.util.jar.Attributes;

Metadata metadata = new Metadata("Jane Doe", "entry", "<ENTRY_UID>", "<CONTENT_TYPE_UID>",
        "INLINE", "", new Attributes());
Log.d("Contentstack", "Embedded item: " + metadata.getItemUid());
```

## getOuterHTML

getOuterHTML returns the outer HTML stored for the embedded item.

```
Returns: String. The outer HTML of the embedded item.
ValidationThere is no client-side validation, and getOuterHTML does not throw.BehaviorClient-side only. getOuterHTML returns a value stored in the object and makes no request.The value is the outerHTML argument of the constructor.Inside SDKUtil.jsonToHTML, the SDK always passes an empty string, so the value is empty for every Metadata that the SDK builds.ExampleBasic usage: read the outer HTMLimport android.util.Log;

import com.contentstack.sdk.Metadata;

import java.util.jar.Attributes;

Metadata metadata = new Metadata("Jane Doe", "entry", "<ENTRY_UID>", "<CONTENT_TYPE_UID>",
        "INLINE", "", new Attributes());
Log.d("Contentstack", "Outer HTML is empty: " + metadata.getOuterHTML().isEmpty()); // true
```

## getStyleType

getStyleType returns the display style of the embedded item, for example inline or block.

```
Returns: StyleType. The display style of the embedded item.
ValidationThere is no client-side validation, and getStyleType does not throw.BehaviorClient-side only. getStyleType returns a value stored in the object and makes no request.The value is one of the five StyleType values: BLOCK, INLINE, LINK, DISPLAY or DOWNLOAD. The constructor converts its styleType string to this value.StyleType is package-private, so code outside com.contentstack.sdk cannot name the type or call its methods. Pass the result to String.valueOf and compare the string, as the example below shows.DefaultOption renderOptions picks its HTML by this value.Inside SDKUtil.jsonToHTML, the SDK sets this value from the display-type attribute of the reference node. See How the SDK fills a Metadata on the Metadata class page.ExampleBasic usage: compare the display styleimport android.util.Log;

import com.contentstack.sdk.Metadata;

import java.util.jar.Attributes;

Metadata metadata = new Metadata("Jane Doe", "entry", "<ENTRY_UID>", "<CONTENT_TYPE_UID>",
        "INLINE", "", new Attributes());
String style = String.valueOf(metadata.getStyleType());
if ("INLINE".equals(style)) {
    Log.d("Contentstack", "The item sits inside a line of text");
}
```

## getText

getText returns the text of the reference that embeds an item in a JSON Rich Text Editor field.

```
Returns: String. The text of the embedded item.
ValidationThere is no client-side validation, and getText does not throw.BehaviorClient-side only. getText returns a value stored in the object and makes no request.The value is the text argument of the constructor.Inside SDKUtil.jsonToHTML, the SDK sets this value from the text attribute of the reference node. See How the SDK fills a Metadata on the Metadata class page.ExampleBasic usage: read the textimport android.util.Log;

import com.contentstack.sdk.Metadata;

import java.util.jar.Attributes;

Metadata metadata = new Metadata("Jane Doe", "entry", "<ENTRY_UID>", "<CONTENT_TYPE_UID>",
        "INLINE", "", new Attributes());
Log.d("Contentstack", "Text: " + metadata.getText()); // Text: Jane Doe
```

## toString

toString returns every value of the Metadata in one string, for logging.

```
Returns: String. The metadata as a readable string.
ValidationThere is no client-side validation, and toString does not throw.BehaviorClient-side only. toString returns a value stored in the object and makes no request.The string has the form EmbeddedObject{text='...'type='...', uid='...', contentTypeUid='...', sysStyleType=..., outerHTML='...', attributes='...'}.No comma separates the text and type values. Call the getters, not a parser on this string, to read one value.ExampleBasic usage: log the metadataimport android.util.Log;

import com.contentstack.sdk.Metadata;

import java.util.jar.Attributes;

Metadata metadata = new Metadata("Jane Doe", "entry", "<ENTRY_UID>", "<CONTENT_TYPE_UID>",
        "INLINE", "", new Attributes());
Log.d("Contentstack", metadata.toString());
```

## Metadata | Android Delivery SDK | Contentstack

The Metadata class in the Android Delivery SDK holds the details of one entry or asset embedded in a JSON Rich Text Editor field, such as its UID and display style.