com.google.gdata.model.atom
Class Content

java.lang.Object
  extended by com.google.gdata.model.Element
      extended by com.google.gdata.model.atom.Content
All Implemented Interfaces:
IContent
Direct Known Subclasses:
OtherContent, OutOfLineContent, TextContent

public class Content
extends Element
implements IContent

Base class for entry content.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.google.gdata.data.IContent
IContent.Type
 
Field Summary
static ElementKey<java.lang.String,Content> CONSTRUCT
          The key for Content used as a construct.
static ElementKey<java.lang.String,Content> KEY
          The key for a Content element used as atom:content.
static AttributeKey<java.net.URI> SRC
          The src attribute.
static AttributeKey<java.lang.String> TYPE
          The content type attribute.
static AttributeKey<java.lang.String> XML_LANG
          Key for the XML lang attribute
 
Constructor Summary
  Content(ElementKey<?,?> key)
          Constructs a new instance using the specified element metadata.
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).
 
Method Summary
 java.lang.String getLang()
          Returns the human language that this content is written in
 ContentType getMimeType()
           
 java.net.URI getSrc()
           
 int getType()
          Returns this content's type.
protected  Element narrow(ElementMetadata<?,?> meta, ValidationContext vc)
          Narrow down element's type to the most specific one possible.
static void registerMetadata(MetadataRegistry registry)
          Registers the default metadata for this element.
 void setLang(java.lang.String lang)
          Sets the human language that this content was is written in.
 
Methods inherited from class com.google.gdata.model.Element
adapt, adapt, addElement, addElement, addElement, clear, createElement, createElement, eq, equals, getAttributeCount, getAttributeIterator, getAttributeIterator, getAttributeValue, getAttributeValue, getDefaultKey, getElement, getElement, getElementCount, getElementId, getElementIterator, getElementIterator, getElementKey, getElements, getElements, getElementSet, getElementSet, getElementValue, getElementValue, getTextValue, getTextValue, hasAttribute, hasAttribute, hasElement, hasElement, hashCode, hasTextValue, isLocked, lock, removeAttribute, removeAttribute, removeAttributeValue, removeAttributeValue, removeElement, removeElement, removeElement, removeElement, replaceElement, resolve, resolve, sameClassAs, setAttributeValue, setAttributeValue, setElement, setElement, setElement, setTextValue, toString, validate, visit
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CONSTRUCT

public static final ElementKey<java.lang.String,Content> CONSTRUCT
The key for Content used as a construct. This will apply to all uses of Content regardless of QName.


KEY

public static final ElementKey<java.lang.String,Content> KEY
The key for a Content element used as atom:content.


XML_LANG

public static final AttributeKey<java.lang.String> XML_LANG
Key for the XML lang attribute


TYPE

public static final AttributeKey<java.lang.String> TYPE
The content type attribute.


SRC

public static final AttributeKey<java.net.URI> SRC
The src attribute.

Constructor Detail

Content

public Content(ElementKey<?,?> key)
Constructs a new instance using the specified element metadata.

Parameters:
key - the element key for the content element.

Content

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.
Method Detail

registerMetadata

public static void registerMetadata(MetadataRegistry registry)
Registers the default metadata for this element.


getType

public int getType()
Returns this content's type. The list of valid value is defined in IContent.Type.

Specified by:
getType in interface IContent
Returns:
the type of content.
See Also:
IContent.Type

getLang

public java.lang.String getLang()
Returns the human language that this content is written in

Specified by:
getLang in interface IContent
Returns:
the language of the content if available, or null if not.

setLang

public void setLang(java.lang.String lang)
Sets the human language that this content was is written in.


getMimeType

public ContentType getMimeType()
Returns:
the MIME content type, or null if none exists

getSrc

public java.net.URI getSrc()
Returns:
the external URI, or null if none exists

narrow

protected Element narrow(ElementMetadata<?,?> meta,
                         ValidationContext vc)
Description copied from class: Element
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.

Overrides:
narrow in class Element
Parameters:
meta - the element metadata to narrow to.
vc - validation context
Returns:
element narrowed down to the most specific type