public class ContentHelper
extends java.lang.Object
content element
of an Atom Entry instance. A configured instance of this
class can be made available in a resource class as follows:
@Context private ContentHelper contentHelper;
| Constructor and Description |
|---|
ContentHelper(Providers providers)
Construct a configured instance of this helper.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getContentEntity(org.apache.abdera.model.Entry entry,
java.lang.Class<T> clazz)
Deserialize the content element of the specified entry, and
transform it back into an appropriate Java object.
|
<T> T |
getContentEntity(org.apache.abdera.model.Entry entry,
MediaType mediaType,
java.lang.Class<T> clazz)
Deserialize the content element of the specified entry, and
transform it back into an appropriate Java object.
|
void |
setContentEntity(org.apache.abdera.model.Entry entry,
MediaType mediaType,
java.lang.Object entity)
Serialize the specified entity as the
content element
of the specified entry. |
public ContentHelper(Providers providers)
Construct a configured instance of this helper.
providers - Providers for this applicationpublic <T> T getContentEntity(org.apache.abdera.model.Entry entry,
java.lang.Class<T> clazz)
Deserialize the content element of the specified entry, and
transform it back into an appropriate Java object. The media type
used for selecting an appropriate Provider will be
acquired from the type attribute of the content
element.
entry - Entry whose content element is to be processedclazz - Class of the object to be returnedjava.lang.IllegalArgumentException - if the specified entry does not
contain a valid content elementpublic <T> T getContentEntity(org.apache.abdera.model.Entry entry,
MediaType mediaType,
java.lang.Class<T> clazz)
Deserialize the content element of the specified entry, and transform it back into an appropriate Java object.
entry - Entry whose content element is to be processedmediaType - MediaType to use when selecting an
appropriate providerclazz - Class of the object to be returnedjava.lang.IllegalArgumentException - if the specified entry does not
contain a valid content elementpublic void setContentEntity(org.apache.abdera.model.Entry entry,
MediaType mediaType,
java.lang.Object entity)
Serialize the specified entity as the content element
of the specified entry. The selected provider MUST
produce an XML representation.
entry - Entry whose content element is to be setmediaType - MediaType to pass as the type
attribute of the content element (also used to select an
appropriate Provider)entity - Entity to be serializedCopyright © 2016 Oracle Corporation. All Rights Reserved.