|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wink.common.model.atom.AtomCommonAttributes
org.apache.wink.common.model.atom.AtomText
public class AtomText
Text Construct Per RFC4287
A Text construct contains human-readable text, usually in small quantities. The content of Text
constructs is Language-Sensitive.
atomPlainTextConstruct =
atomCommonAttributes,
attribute type { "text" | "html" }?,
text
atomXHTMLTextConstruct =
atomCommonAttributes,
attribute type { "xhtml" },
xhtmlDiv
atomTextConstruct = atomPlainTextConstruct | atomXHTMLTextConstruct
o The "type" Attribute
Text constructs MAY have a "type" attribute. When present, the value MUST be one of "text",
"html", or "xhtml". If the "type" attribute is not provided, Atom Processors MUST behave as
though it were present with a value of "text". Unlike the atom:content element defined in Section
4.1.3, MIME media types [MIMEREG] MUST NOT be used as values for the "type" attribute on Text
constructs.
o Text
Example atom:title with text content:
... <title type="text"> Less: < </title> ...
If the value is "text", the content of the Text construct MUST NOT contain child elements. Such
text is intended to be presented to humans in a readable fashion. Thus, Atom Processors MAY
collapse white space (including line breaks) and display the text using typographic techniques
such as justification and proportional fonts.
o HTML
Example atom:title with HTML content:
... <title type="html"> Less: <em> < </em> </title> ...
If the value of "type" is "html", the content of the Text construct MUST NOT contain child
elements and SHOULD be suitable for handling as HTML [HTML]. Any markup within MUST be escaped;
for example, "<br>
" as "<br>". HTML markup within SHOULD be such that it could validly appear directly within an
HTML <DIV> element, after unescaping. Atom Processors that display such content MAY use that
markup to aid in its display.
o XHTML
Example atom:title with XHTML content:
... <title type="xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <xhtml:div> Less: <xhtml:em>
< </xhtml:em> </xhtml:div> </title> ...
If the value of "type" is "xhtml", the content of the Text construct MUST be a single XHTML div
element [XHTML] and SHOULD be suitable for handling as XHTML. The XHTML div element itself MUST
NOT be considered part of the content. Atom Processors that display the content MAY use the
markup to aid in displaying it. The escaped versions of characters such as "&" and ">" represent
those characters, not markup.
Examples of valid XHTML content:
... <summary type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml"> This is <b>XHTML</b>
content. </div> </summary> ... <summary type="xhtml"> <xhtml:div
xmlns:xhtml="http://www.w3.org/1999/xhtml"> This is <xhtml:b>XHTML</xhtml:b> content.
</xhtml:div> </summary> ...
The following example assumes that the XHTML namespace has been bound to the "xh" prefix earlier
in the document:
... <summary type="xhtml"> <xh:div> This is <xh:b>XHTML</xh:b> content. </xh:div> </summary> ...
| Field Summary | |
|---|---|
protected AtomTextType |
type
|
| Fields inherited from class org.apache.wink.common.model.atom.AtomCommonAttributes |
|---|
base, lang |
| Constructor Summary | |
|---|---|
AtomText()
Create an empty AtomText with no type and no value |
|
AtomText(String value)
Create an AtomText with a type of AtomTextType.TEXT |
|
AtomText(String value,
AtomTextType type)
Create an AtomText with the specified value and type |
|
AtomText(SyndText value)
|
|
| Method Summary | ||
|---|---|---|
AtomTextType |
getType()
Gets the value of type. |
|
String |
getValue()
Gets the content of the "atom:text" element as a String. |
|
|
getValue(Class<T> cls)
Gets the content of the "atom:text" element serialized to provided class. |
|
|
getValue(Class<T> cls,
Type genericType,
javax.ws.rs.ext.Providers providers,
Annotation[] annotations,
javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders,
javax.ws.rs.core.MediaType mediaType)
Gets the content of the "atom:text" element serialized to provided class according to provided parameters. |
|
void |
setType(AtomTextType type)
Sets the value of type. |
|
void |
setValue(Object value)
|
|
SyndText |
toSynd(SyndText value)
|
|
| Methods inherited from class org.apache.wink.common.model.atom.AtomCommonAttributes |
|---|
getBase, getLang, getOtherAttributes, setBase, setLang, toSynd |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected AtomTextType type
| Constructor Detail |
|---|
public AtomText()
public AtomText(String value)
value - the TEXT value
public AtomText(String value,
AtomTextType type)
value - type - public AtomText(SyndText value)
| Method Detail |
|---|
public SyndText toSynd(SyndText value)
public void setValue(Object value)
public String getValue()
Gets the content of the "atom:text" element as a String. The "type" attribute should be used to determine how to treat the content.
Pay attention that de-serialization occurs each time the method is called, so multiple calls to this method may effect the application performance.
public <T> T getValue(Class<T> cls)
Gets the content of the "atom:text" element serialized to provided class. The "type" attribute should be used to determine how to treat the content.
Pay attention that de-serialization occurs each time the method is called, so multiple calls to this method may effect the application performance.
public <T> T getValue(Class<T> cls,
Type genericType,
javax.ws.rs.ext.Providers providers,
Annotation[] annotations,
javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders,
javax.ws.rs.core.MediaType mediaType)
throws IOException
Gets the content of the "atom:text" element serialized to provided class according to provided parameters.
Pay attention that de-serialization occurs each time the method is called, so multiple calls to this method may effect the application performance.
IOExceptionpublic AtomTextType getType()
AtomTextTypepublic void setType(AtomTextType type)
value - allowed object is AtomTextType
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||