public class

Content

extends Element
implements IContent
java.lang.Object
   ↳ com.google.gdata.model.Element
     ↳ com.google.gdata.model.atom.Content
Known Direct Subclasses

Class Overview

Base class for entry content.

Summary

Fields
public static final ElementKey<String, Content> CONSTRUCT The key for Content used as a construct.
public static final ElementKey<String, Content> KEY The key for a Content element used as atom:content.
public static final AttributeKey<URI> SRC The src attribute.
public static final AttributeKey<String> TYPE The content type attribute.
public static final AttributeKey<String> XML_LANG Key for the XML lang attribute
[Expand]
Inherited Fields
From class com.google.gdata.model.Element
Public Constructors
Content(ElementKey<?, ?> key)
Constructs a new instance using the specified element metadata.
Protected Constructors
Content(ElementKey<?, ?> key, Element source)
Constructs a new instance using the specified element key and the source Element instance's data (attributes, child elements, text content).
Public Methods
String getLang()
Returns the human language that this content is written in
ContentType getMimeType()
URI getSrc()
int getType()
Returns this content's type.
static void registerMetadata(MetadataRegistry registry)
Registers the default metadata for this element.
void setLang(String lang)
Sets the human language that this content was is written in.
Protected Methods
Element narrow(ElementMetadata<?, ?> meta, ValidationContext vc)
Narrow down element's type to the most specific one possible.
[Expand]
Inherited Methods
From class com.google.gdata.model.Element
From class java.lang.Object
From interface com.google.gdata.data.IContent

Fields

public static final ElementKey<String, Content> CONSTRUCT

The key for Content used as a construct. This will apply to all uses of Content regardless of QName.

public static final ElementKey<String, Content> KEY

The key for a Content element used as atom:content.

public static final AttributeKey<URI> SRC

The src attribute.

public static final AttributeKey<String> TYPE

The content type attribute.

public static final AttributeKey<String> XML_LANG

Key for the XML lang attribute

Public Constructors

public Content (ElementKey<?, ?> key)

Constructs a new instance using the specified element metadata.

Parameters
key The element key for the content element.

Protected Constructors

protected Content (ElementKey<?, ?> key, Element source)

Constructs a new instance using the specified element key and the source Element instance's data (attributes, child elements, text content).

Parameters
key The element key for the content element.
source Source content.

Public Methods

public String getLang ()

Returns the human language that this content is written in

Returns
  • the language of the content if available, or null if not.

public ContentType getMimeType ()

Returns
  • the MIME content type, or null if none exists

public URI getSrc ()

Returns
  • the external URI, or null if none exists

public int getType ()

Returns this content's type. The list of valid value is defined in IContent.Type.

Returns
  • the type of content.
See Also

public static void registerMetadata (MetadataRegistry registry)

Registers the default metadata for this element.

Parameters
registry

public void setLang (String lang)

Sets the human language that this content was is written in.

Parameters
lang

Protected Methods

protected Element narrow (ElementMetadata<?, ?> meta, ValidationContext vc)

Narrow down element's type to the most specific one possible.

Any validation errors discovered during narrowing are accumulated in the validation context.

Default action is to not do anything with current element. Subclasses may override this function to narrow the type in some custom fashion.

Parameters
meta The element metadata to narrow to.
vc Validation context
Returns
  • element narrowed down to the most specific type