final ClassExternalizerFactory jbmarExtFactory = new AnnotationClassExternalizerFactory();
@Override
public Externalizer getExternalizer(Class<?> type) {
SerializeWith ann = type.getAnnotation(SerializeWith.class);
if (ann == null) {
// Check for JBoss Marshaller's @Externalize
return jbmarExtFactory.getExternalizer(type);
} else {
try {
return new JBossExternalizerAdapter(ann.value().newInstance());
} catch (Exception e) {
throw new IllegalArgumentException(String.format(
"Cannot instantiate externalizer for %s", type), e);
}
}