@SuppressWarnings("unchecked")
protected Object checkAdapter(Object obj, Class<?> cls, Annotation[] anns, boolean marshal) {
XmlJavaTypeAdapter typeAdapter = getAdapter(obj.getClass(), anns);
if (typeAdapter != null) {
try {
XmlAdapter xmlAdapter = typeAdapter.value().newInstance();
if (marshal) {
return xmlAdapter.marshal(obj);
} else {
return xmlAdapter.unmarshal(obj);
}
} catch (Exception ex) {
LOG.warning("Problem using the XmlJavaTypeAdapter");
ex.printStackTrace();
}