ObjectMapper mapper = new ObjectMapper();
if (cls != null) {
// Workaround for http://jira.codehaus.org/browse/JACKSON-413
Package pkg = cls.getPackage();
if (pkg != null) {
XmlJavaTypeAdapters adapters = pkg.getAnnotation(XmlJavaTypeAdapters.class);
if (adapters != null) {
CustomSerializerFactory serializerFactory = new CustomSerializerFactory();
CustomDeserializerFactory deserializerFactory = new CustomDeserializerFactory();
for (XmlJavaTypeAdapter a : adapters.value()) {
XmlAdapter xmlAdapter = null;
try {
xmlAdapter = a.value().newInstance();
} catch (Throwable e) {
// Ignore