// 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();
BeanDeserializerFactory deserializerFactory = new BeanDeserializerFactory(null);
for (XmlJavaTypeAdapter a : adapters.value()) {
XmlAdapter xmlAdapter = null;
try {
xmlAdapter = a.value().newInstance();
} catch (Throwable e) {
// Ignore
}
if (xmlAdapter != null) {
XmlAdapterJsonDeserializer deserializer = new XmlAdapterJsonDeserializer(xmlAdapter);
XmlAdapterJsonSerializer serializer = new XmlAdapterJsonSerializer(xmlAdapter);
SimpleDeserializers deserializers = new SimpleDeserializers();
deserializers.addDeserializer(a.type(), deserializer);
deserializerFactory.withAdditionalDeserializers(deserializers);
serializerFactory.addGenericMapping(a.type(), serializer);
StdDeserializerProvider deserializerProvider =
new StdDeserializerProvider(deserializerFactory);
mapper = new ObjectMapper();
//mapper.registerModule(new JsonOrgModule());