T
- the type of encoded outputpublic interface ObjectFormatter<T>
managed
persistence
instances or a persistent domain model
into a form suitable for transport to a language-neutral
client such as an web browser.
The interface prefers that the resultant resource as a complete representation i.e. all the references contained in the resource can be resolved within the same resource itself. As the intended recipient of this resource is a remote client, an incomplete resource will require the client to request further for any (unresolved) reference resulting in a chatty protocol.
This interface also defines methods for writing the representation into an output stream e.g.
response output stream
of a HTTP Servlet.
Implementation Note: Each concrete formatter type is registered with factory that requires the implementation to have a no-argument constructor.
Modifier and Type | Field and Description |
---|---|
static java.text.SimpleDateFormat |
dateFormat |
Modifier and Type | Method and Description |
---|---|
T |
encode(java.util.Collection<OpenJPAStateManager> objs,
javax.persistence.metamodel.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. |
T |
encode(javax.persistence.metamodel.Metamodel model)
Encode the given domain model in to a object.
|
java.lang.String |
getMimeType()
Gets the mime type produced by this formatter.
|
T |
writeOut(java.util.Collection<OpenJPAStateManager> objs,
javax.persistence.metamodel.Metamodel model,
java.lang.String title,
java.lang.String desc,
java.lang.String uri,
java.io.OutputStream out)
Encodes the
persistent closure of the given collection of objects, then write it into
the given output stream. |
T |
writeOut(javax.persistence.metamodel.Metamodel model,
java.lang.String title,
java.lang.String desc,
java.lang.String uri,
java.io.OutputStream out)
Encodes the given domain model, then write it into the given output stream.
|
java.lang.String getMimeType()
T encode(java.util.Collection<OpenJPAStateManager> objs, javax.persistence.metamodel.Metamodel model)
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.objs
- a collection of managed instancesmodel
- domain modelT encode(javax.persistence.metamodel.Metamodel model)
model
- a meta-model of managed typesT writeOut(java.util.Collection<OpenJPAStateManager> objs, javax.persistence.metamodel.Metamodel model, java.lang.String title, java.lang.String desc, java.lang.String uri, java.io.OutputStream out) throws java.io.IOException
persistent closure
of the given collection of objects, then write it into
the given output stream.objs
- the collection of objects to be formatted.model
- a meta-model of managed types, provided for easier introspection if necessarytitle
- TODOdesc
- TODOuri
- TODOwriter
- a text-oriented output streamjava.io.IOException
T writeOut(javax.persistence.metamodel.Metamodel model, java.lang.String title, java.lang.String desc, java.lang.String uri, java.io.OutputStream out) throws java.io.IOException
model
- a meta-model of managed typeswriter
- a text-oriented output streamjava.io.IOException
Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.