|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gdata.model.Element
com.google.gdata.model.atom.Content
com.google.gdata.model.atom.TextContent
public class TextContent
Variant of Content
for entries containing text.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.google.gdata.data.IContent |
---|
IContent.Type |
Nested classes/interfaces inherited from interface com.google.gdata.data.ITextConstruct |
---|
ITextConstruct.Type |
Field Summary | |
---|---|
static ElementKey<java.lang.String,TextContent> |
CONSTRUCT
The key for TextContent used as a construct. |
static ElementKey<java.lang.String,XmlBlob> |
DIV
The key for xhtml:div. |
static ElementKey<java.lang.String,TextContent> |
KEY
The key for atom:content when it contains TextContent. |
static java.lang.String |
KIND
The kind name for adaptation. |
Fields inherited from class com.google.gdata.model.atom.Content |
---|
SRC, TYPE, XML_LANG |
Constructor Summary | |
---|---|
TextContent()
Constructs a new plain text instance using the default key. |
Method Summary | |
---|---|
static TextContent |
create(int type,
java.lang.String textOrHtml,
XmlBlob xhtml)
Creates a text content. |
ITextConstruct |
getContent()
Returns the ITextConstruct that contains the text content. |
java.lang.String |
getHtml()
Backwards-compatibility method, exactly the same as getText() . |
java.lang.String |
getPlainText()
Returns a plain-text representation of this text content. |
java.lang.String |
getText()
Returns the text content of this element, if this is a plain text or html text content. |
int |
getType()
Returns the type of this content, either Content.Type#TEXT ,
Content.Type#HTML , or Content.Type#XHTML . |
XmlBlob |
getXhtml()
Returns the XHTML content of this text content, or null if no such
element exists. |
static TextContent |
html(java.lang.String html)
Construct a new html text content with the given html. |
boolean |
isEmpty()
Returns true if there is no content element for this text content. |
static TextContent |
plainText(java.lang.String text)
Construct a new plain text content with the given text. |
static void |
registerMetadata(MetadataRegistry registry)
Registers the metadata for this element. |
Element |
resolve(ElementMetadata<?,?> metadata,
ValidationContext vc)
Resolve this element's state against the metadata. |
void |
setHtml(java.lang.String html)
Specifies the text of this element, turning this into an html text content element if it wasn't already. |
void |
setText(java.lang.String text)
Specifies the text of this element, turning this into a plain-text content element if it wasn't already. |
void |
setXhtml(XmlBlob div)
Specifies the XHTML content of this element, turning this into an xhtml text content element if it wasn't already. |
static TextContent |
xhtml(XmlBlob div)
Construct a new Xhtml text content from the given div. |
Methods inherited from class com.google.gdata.model.atom.Content |
---|
getLang, getMimeType, getSrc, setLang |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.google.gdata.data.IContent |
---|
getLang |
Field Detail |
---|
public static final java.lang.String KIND
public static final ElementKey<java.lang.String,TextContent> CONSTRUCT
public static final ElementKey<java.lang.String,TextContent> KEY
public static final ElementKey<java.lang.String,XmlBlob> DIV
Constructor Detail |
---|
public TextContent()
Method Detail |
---|
public static void registerMetadata(MetadataRegistry registry)
public static TextContent create(int type, java.lang.String textOrHtml, XmlBlob xhtml)
type
- the type of the new text construct (TEXT, HTML, or XHTML)textOrHtml
- the contents to put in this text construct, if the type is
TEXT or HTML.
If type is XHTML, set this parameter to null
.xhtml
- the contents to put in this text construct, if the type is
XHTML.
If type is TEXT or HTML, set this parameter to null
.
TextConstruct
of the appropriate type.public static TextContent plainText(java.lang.String text)
public static TextContent html(java.lang.String html)
public static TextContent xhtml(XmlBlob div)
public int getType()
Content.Type#TEXT
,
Content.Type#HTML
, or Content.Type#XHTML
. If the value
of the Content.TYPE
attribute is unknown, plain text
Content.Type#TEXT
will be returned.
getType
in interface IContent
getType
in interface ITextConstruct
getType
in class Content
IContent.Type
public boolean isEmpty()
true
if there is no content element for this text content.
public java.lang.String getPlainText()
getPlainText
in interface ITextConstruct
public java.lang.String getText()
getPlainText()
instead.
public java.lang.String getHtml()
getText()
.
public XmlBlob getXhtml()
null
if no such
element exists.
public void setText(java.lang.String text)
public void setHtml(java.lang.String html)
public void setXhtml(XmlBlob div)
public Element resolve(ElementMetadata<?,?> metadata, ValidationContext vc)
resolve
in class Element
vc
- validation context
public ITextConstruct getContent()
ITextContent
ITextConstruct
that contains the text content.
getContent
in interface ITextContent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |