|
TrueUpdate Core 0.1.7 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.java.trueupdate.core.codec.JaxbCodec
@Immutable public class JaxbCodec
A codec which encodes/decodes objects to/from XML with a
Marshaller/Unmarshaller derived from a JAXBContext.
This type of codec does not support encoding or decoding
null.
| Field Summary | |
|---|---|
protected JAXBContext |
context
The JAXB context provided to the constructor. |
| Constructor Summary | |
|---|---|
JaxbCodec(JAXBContext context)
|
|
| Method Summary | ||
|---|---|---|
String |
contentTransferEncoding()
Returns an identifier for the content transfer encoding used by this codec. |
|
String |
contentType()
Returns an identifier for the content type used by this codec. |
|
|
decode(Source source,
Type expected)
Decodes a nullable object graph from the given source. |
|
void |
encode(Sink sink,
Object obj)
Encodes a nullable object graph to the given sink. |
|
protected Marshaller |
marshaller()
Returns a new marshaller. |
|
protected Unmarshaller |
unmarshaller()
Returns a new unmarshaller. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final JAXBContext context
| Constructor Detail |
|---|
public JaxbCodec(JAXBContext context)
| Method Detail |
|---|
public String contentTransferEncoding()
If the Content-Transfer-Encoding equals (ignoring case) "8bit"
and the Content-Type does not specify a
charset parameter, then UTF-8 is assumed as the charset.
The implementation in the class JaxbCodec
returns "8bit".
contentTransferEncoding in interface Codecpublic String contentType()
The implementation in the class JaxbCodec
returns "application/xml; charset=utf-8".
contentType in interface Codec
public <T> T decode(Source source,
Type expected)
throws Exception
Codec
decode in interface CodecT - the expected generic type of the decoded object.source - the source from where to read the encoded object graph
from.expected - the expected generic type of the decoded object graph,
e.g. String.class.
This is just a hint and the implementation may ignore it.
null if and only if the original object graph
was null.
Exception
public void encode(Sink sink,
Object obj)
throws Exception
Codec
encode in interface Codecsink - the sink to write the encoded object graph to.obj - the nullable object graph.
Implementations should support encoding null.
If they do not support this, then this should be documented in
the Javadoc.
Exception
protected Marshaller marshaller()
throws JAXBException
JAXBException
protected Unmarshaller unmarshaller()
throws JAXBException
JAXBException
|
TrueUpdate Core 0.1.7 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||