use of org.jooq.exception.ConfigurationException in project jOOQ by jOOQ.
the class MiniJAXB method marshal.
public static void marshal(XMLAppendable object, Writer out) {
try {
XMLBuilder builder = XMLBuilder.formatting();
XmlRootElement e = object.getClass().getAnnotation(XmlRootElement.class);
if (e != null) {
out.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n");
builder.append(e.name(), object);
} else
builder.append(object);
builder.appendTo(out);
} catch (Exception e) {
throw new ConfigurationException("Cannot print object", e);
}
}
use of org.jooq.exception.ConfigurationException in project jOOQ by jOOQ.
the class MiniJAXB method unmarshal0.
private static <T extends XMLAppendable> T unmarshal0(InputSource in, Class<T> type) {
try {
addDefaultNamespace(in, type);
Document document = builder(type).parse(in);
T result = Reflect.on(type).create().get();
unmarshal0(result, document.getDocumentElement(), new IdentityHashMap<Class<?>, Map<String, Field>>());
return result;
} catch (Exception e) {
throw new ConfigurationException("Error while reading xml", e);
}
}
Aggregations