Package ball.activation
Class JAXBDataSource
- java.lang.Object
-
- ball.activation.AbstractDataSource
-
- ball.activation.FilterDataSource
-
- ball.activation.ReaderWriterDataSource
-
- ball.activation.JAXBDataSource
-
- All Implemented Interfaces:
DataSourceDefaultMethods,DataSource
public class JAXBDataSource extends ReaderWriterDataSource
ReaderWriterDataSourceimplementation to provideMarshallermarshalling andUnmarshallerunmarshalling services.- Author:
- Allen D. Ball
-
-
Field Summary
-
Fields inherited from class ball.activation.ReaderWriterDataSource
CHARSET
-
Fields inherited from interface ball.activation.DataSourceDefaultMethods
APPLICATION_OCTET_STREAM, APPLICATION_XML, CONTENT_TYPE, TEXT_HTML, TEXT_PLAIN
-
-
Constructor Summary
Constructors Constructor Description JAXBDataSource()No-argument constructor.JAXBDataSource(Object object)Construct and marshal the argumentObject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidmarshal(Object object)Marshal the argumentObject.voidmarshal(JAXBContext context, Object object)Marshal the argumentObject.<T> Tunmarshal(Class<? extends T> type)Unmarshal the argumentObject.<T> Tunmarshal(JAXBContext context, Class<? extends T> type)Unmarshal the argumentObject.-
Methods inherited from class ball.activation.ReaderWriterDataSource
getBufferedReader, getCharset, getPrintStream, getPrintWriter, getReader, getWriter, nameOf, toString, writeTo
-
Methods inherited from class ball.activation.FilterDataSource
getContentType, getDataSource, getInputStream, getName, getOutputStream, setContentType, setName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ball.activation.DataSourceDefaultMethods
clear, getInputStream, getOutputStream, length, wrap, wrap
-
-
-
-
Constructor Detail
-
JAXBDataSource
public JAXBDataSource(Object object)
Construct and marshal the argumentObject.- Parameters:
object- TheObjectto marshal.
-
JAXBDataSource
public JAXBDataSource()
No-argument constructor.
-
-
Method Detail
-
marshal
public void marshal(Object object) throws IOException, JAXBException
Marshal the argumentObject.- Parameters:
object- TheObjectto marshal.- Throws:
IOException- If an I/O exception occurs.JAXBException- If a JAXB exception occurs.
-
marshal
public void marshal(JAXBContext context, Object object) throws IOException, JAXBException
Marshal the argumentObject.- Parameters:
context- TheJAXBContext.object- TheObjectto marshal.- Throws:
IOException- If an I/O exception occurs.JAXBException- If a JAXB exception occurs.
-
unmarshal
public <T> T unmarshal(Class<? extends T> type) throws IOException, JAXBException
Unmarshal the argumentObject.- Type Parameters:
T- The target type.- Parameters:
type- The targetClass.- Returns:
- The unmarshalled
Object. - Throws:
IOException- If an I/O exception occurs.JAXBException- If a JAXB exception occurs.
-
unmarshal
public <T> T unmarshal(JAXBContext context, Class<? extends T> type) throws IOException, JAXBException
Unmarshal the argumentObject.- Type Parameters:
T- The target type.- Parameters:
context- TheJAXBContext.type- The targetClass.- Returns:
- The unmarshalled
Object. - Throws:
IOException- If an I/O exception occurs.JAXBException- If a JAXB exception occurs.
-
-