Attachment Class

public class Attachment
extends Resource

Represents a document attachment in the Azure Cosmos DB database service.

Each document may contain zero or more attachemnts. Attachments can be of any MIME type - text, image, binary data. These are stored externally in Azure Blob storage. Attachments are automatically deleted when the parent document is deleted.

Constructor Summary

Constructor Description
Attachment()

Initialize an attachment object.

Attachment(String source)

Initialize an attachment object from json string.

Attachment(JSONObject jsonObject)

Initialize an attachment object from json object.

Method Summary

Modifier and Type Method and Description
java.lang.String getContentType()

Gets the MIME content type of the attachment.

java.lang.String getMediaLink()

Gets the media link associated with the attachment content.

void setContentType(String contentType)

Sets the MIME content type of the attachment.

void setMediaLink(String mediaLink)

Sets the media link associated with the attachment content.

Methods inherited from JsonSerializable

Methods inherited from Resource

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

Attachment

public Attachment()

Initialize an attachment object.

Attachment

public Attachment(String source)

Initialize an attachment object from json string.

Parameters:

source - the json string representation of the Attachment.

Attachment

public Attachment(JSONObject jsonObject)

Initialize an attachment object from json object.

Parameters:

jsonObject - the json object representation of the Attachment.

Method Details

getContentType

public String getContentType()

Gets the MIME content type of the attachment.

Returns:

the content type.

getMediaLink

public String getMediaLink()

Gets the media link associated with the attachment content.

Returns:

the media link.

setContentType

public void setContentType(String contentType)

Sets the MIME content type of the attachment.

Parameters:

contentType - the content type to use.

setMediaLink

public void setMediaLink(String mediaLink)

Sets the media link associated with the attachment content.

Parameters:

mediaLink - the media link to use.

Applies to