Interface ObjectFormatter<T>
- 
- Type Parameters:
 T- the type of encoded output
- All Known Implementing Classes:
 JSONObjectFormatter,XMLFormatter
public interface ObjectFormatter<T>A parameterized interface defines the protocol for convertingmanagedpersistence instances or a persistentdomain modelinto 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 streamof a HTTP Servlet.Implementation Note: Each concrete formatter type is registered with factory that requires the implementation to have a no-argument constructor.
- Author:
 - Pinaki Poddar
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static SimpleDateFormatdateFormat 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tencode(jakarta.persistence.metamodel.Metamodel model)Encode the given domain model in to a object.Tencode(Collection<OpenJPAStateManager> objs, jakarta.persistence.metamodel.Metamodel model)Encode thepersistent closureof 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.StringgetMimeType()Gets the mime type produced by this formatter.TwriteOut(jakarta.persistence.metamodel.Metamodel model, String title, String desc, String uri, OutputStream out)Encodes the given domain model, then write it into the given output stream.TwriteOut(Collection<OpenJPAStateManager> objs, jakarta.persistence.metamodel.Metamodel model, String title, String desc, String uri, OutputStream out)Encodes thepersistent closureof the given collection of objects, then write it into the given output stream. 
 - 
 
- 
- 
Field Detail
- 
dateFormat
static final SimpleDateFormat dateFormat
 
 - 
 
- 
Method Detail
- 
getMimeType
String getMimeType()
Gets the mime type produced by this formatter. 
- 
encode
T encode(Collection<OpenJPAStateManager> objs, jakarta.persistence.metamodel.Metamodel model)
Encode thepersistent closureof 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.- Parameters:
 objs- a collection of managed instancesmodel- domain model- Returns:
 - an encoded object e.g. a XML or HTML Document or a JSON object.
 
 
- 
encode
T encode(jakarta.persistence.metamodel.Metamodel model)
Encode the given domain model in to a object.- Parameters:
 model- a meta-model of managed types- Returns:
 - an encoded object e.g. a XML or HTML Document or a JSON object.
 
 
- 
writeOut
T writeOut(Collection<OpenJPAStateManager> objs, jakarta.persistence.metamodel.Metamodel model, String title, String desc, String uri, OutputStream out) throws IOException
Encodes thepersistent closureof the given collection of objects, then write it into the given output stream.- Parameters:
 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 stream- Throws:
 IOException
 
- 
writeOut
T writeOut(jakarta.persistence.metamodel.Metamodel model, String title, String desc, String uri, OutputStream out) throws IOException
Encodes the given domain model, then write it into the given output stream.- Parameters:
 model- a meta-model of managed typeswriter- a text-oriented output stream- Throws:
 IOException
 
 - 
 
 -