use of org.jibx.runtime.IBindingFactory in project RESTdoclet by IG-Group.
the class JiBXUtils method marshallController.
/**
* Static method for marshalling a controller.
*
* @param controller the controller to be marshalled.
* @param file the file the controller has to be marshalled to.
* @throws JiBXException if JiBX fails.
* @throws IOException if an input- or output-exception occurs.
*/
public static void marshallController(final Controller controller, final File file) throws JiBXException, IOException {
final Writer writer = new FileWriter(file);
final IBindingFactory factory = BindingDirectory.getFactory(Controller.class);
final IMarshallingContext context = factory.createMarshallingContext();
context.setIndent(INDENT);
context.setOutput(writer);
context.marshalDocument(controller, ENCODING, null);
}
use of org.jibx.runtime.IBindingFactory in project RESTdoclet by IG-Group.
the class JiBXUtils method marshallService.
/**
* Static method for marshalling a service.
*
* @param service the service to be marshalled.
* @param file the file the service has to be marshalled to.
* @throws JiBXException if JiBX fails.
* @throws IOException if an input- or output-exception occurs.
*/
public static void marshallService(final Service service, final File file) throws JiBXException, IOException {
final Writer writer = new FileWriter(file);
final IBindingFactory factory = BindingDirectory.getFactory(Service.class);
final IMarshallingContext context = factory.createMarshallingContext();
context.setIndent(INDENT);
context.setOutput(writer);
context.marshalDocument(service, ENCODING, null);
}
use of org.jibx.runtime.IBindingFactory in project RESTdoclet by IG-Group.
the class JiBXUtils method unmarshallController.
/**
* Static method for unmarshalling a controller.
*
* @param file the file the controller has to be unmarshalled from.
* @return the unmarshalled controller.
* @throws JiBXException if JiBX fails.
* @throws FileNotFoundException if the input file can't be found.
*/
public static Controller unmarshallController(final File file) throws JiBXException, FileNotFoundException {
final IBindingFactory factory = BindingDirectory.getFactory(Controller.class);
final IUnmarshallingContext context = factory.createUnmarshallingContext();
final InputStream stream = new FileInputStream(file);
return (Controller) context.unmarshalDocument(stream, ENCODING);
}
use of org.jibx.runtime.IBindingFactory in project RESTdoclet by IG-Group.
the class JiBXUtils method unmarshallServices.
/**
* Static method for unmarshalling services.
*
* @param input the input-stream services have to be unmarshalled from.
* @return the unmarshalled services..
* @throws JiBXException if JiBX fails.
* @throws FileNotFoundException if the input file can't be found.
*/
public static Services unmarshallServices(final InputStream input) throws JiBXException, FileNotFoundException {
final IBindingFactory factory = BindingDirectory.getFactory(Services.class);
final IUnmarshallingContext context = factory.createUnmarshallingContext();
return (Services) context.unmarshalDocument(input, ENCODING);
}
use of org.jibx.runtime.IBindingFactory in project RESTdoclet by IG-Group.
the class JiBXUtils method unmarshallService.
/**
* Static method for unmarshalling a service.
*
* @param input the input-stream the service has to be unmarshalled from.
* @return the unmarshalled service.
* @throws JiBXException if JiBX fails.
*/
public static Service unmarshallService(final InputStream input) throws JiBXException {
final IBindingFactory factory = BindingDirectory.getFactory(Service.class);
final IUnmarshallingContext context = factory.createUnmarshallingContext();
return (Service) context.unmarshalDocument(input, ENCODING);
}
Aggregations