net.craftforge.essential.supply.jaxb
Class JaxbProducer
java.lang.Object
net.craftforge.essential.supply.Producer
net.craftforge.essential.supply.jaxb.JaxbProducer
public class JaxbProducer
- extends Producer
Serializes objects using JAXB annotations.
- Since:
- 02.12.2010
- Author:
- Christian Bick
| Fields inherited from class net.craftforge.essential.supply.Producer |
config |
|
Method Summary |
void |
json(Object result,
OutputStream out,
String charset)
Serializes the result object to JSON, using the specified character encoding. |
void |
xml(Object result,
OutputStream out,
String charset)
Serializes the result object to XML, using the specified character encoding. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JaxbProducer
public JaxbProducer(Configuration config)
- Constructs the producer by supplying the controller configuration.
- Parameters:
config - The configuration
xml
public void xml(Object result,
OutputStream out,
String charset)
throws JAXBException,
IOException
- Serializes the result object to XML, using the specified character encoding.
Uses the output stream for streaming.
- Parameters:
result - The resultout - The output streamcharset - The character encoding
- Throws:
JAXBException - Failed to serialize object to XML
UnsupportedEncodingException - Unsupported charset encoding
IOException
json
public void json(Object result,
OutputStream out,
String charset)
throws ControllerException,
IOException
- Serializes the result object to JSON, using the specified character encoding.
Uses the output stream for streaming.
- Parameters:
result - The resultout - The output streamcharset - The character encoding
- Throws:
IOException - Failed to serialize object to JSON
ControllerException - Invalid JSON property
Copyright © 2011. All Rights Reserved.