|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.persistence.jest.JSONObjectFormatter
public class JSONObjectFormatter
Marshals a root instance and its persistent closure as JSON object. The closure is resolved against the persistence context that contains the root instance. The JSON format introduces a $id and $ref to address reference that pure JSON does not.
Field Summary |
---|
Fields inherited from interface org.apache.openjpa.persistence.jest.ObjectFormatter |
---|
dateFormat |
Constructor Summary | |
---|---|
JSONObjectFormatter()
|
Method Summary | |
---|---|
JSON |
encode(Collection<OpenJPAStateManager> sms,
Metamodel model)
Encode the persistent closure of the given collection of managed instances as a
resource e.g a XML or HTML document or an interactive document with JavaScript or a JSON array. |
JSON |
encode(Metamodel model)
Encode the given domain model in to a object. |
void |
encode(Object obj,
JPAServletContext ctx)
|
String |
getMimeType()
Gets the mime type produced by this formatter. |
(package private) String |
streamToString(Object value)
Convert the given stream (either an InutStream or a Reader) to a String to be included in CDATA section of a XML document. |
(package private) String |
typeOf(OpenJPAStateManager sm)
|
JSON |
writeOut(Collection<OpenJPAStateManager> sms,
Metamodel model,
String title,
String desc,
String uri,
OutputStream out)
Encodes the persistent closure of the given collection of objects, then write it into
the given output stream. |
JSON |
writeOut(Metamodel model,
String title,
String desc,
String uri,
OutputStream out)
Encodes the given domain model, then write it into the given output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JSONObjectFormatter()
Method Detail |
---|
public String getMimeType()
ObjectFormatter
getMimeType
in interface ObjectFormatter<JSON>
public void encode(Object obj, JPAServletContext ctx)
public JSON writeOut(Collection<OpenJPAStateManager> sms, Metamodel model, String title, String desc, String uri, OutputStream out) throws IOException
ObjectFormatter
persistent closure
of the given collection of objects, then write it into
the given output stream.
writeOut
in interface ObjectFormatter<JSON>
sms
- the collection of objects to be formatted.model
- a meta-model of managed types, provided for easier introspection if necessarytitle
- TODOdesc
- TODOuri
- TODO
IOException
public JSON encode(Collection<OpenJPAStateManager> sms, Metamodel model)
ObjectFormatter
persistent closure
of the given collection of managed instances as a
resource e.g a XML or HTML document or an interactive document with JavaScript or a JSON array.
Exact nature of the output type is the generic parameter of this interface.
encode
in interface ObjectFormatter<JSON>
sms
- a collection of managed instancesmodel
- domain model
String typeOf(OpenJPAStateManager sm)
String streamToString(Object value)
value
- the field value to be converted. Can not be null
public JSON encode(Metamodel model)
ObjectFormatter
encode
in interface ObjectFormatter<JSON>
model
- a meta-model of managed types
public JSON writeOut(Metamodel model, String title, String desc, String uri, OutputStream out) throws IOException
ObjectFormatter
writeOut
in interface ObjectFormatter<JSON>
model
- a meta-model of managed types
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |