Method methods[] = objectFactory.getDeclaredMethods();
for (Method method : methods) {
if (method.getParameterTypes().length == 1
&& method.getParameterTypes()[0].equals(cls)) {
XmlElementDecl elementDecl = method.getAnnotation(XmlElementDecl.class);
if (null != elementDecl) {
String name = elementDecl.name();
String ns = namespace != null ? namespace : elementDecl.namespace();
if (namespace != null) {
helper.setJaxbNamespace(elementDecl.namespace());
}
QName elementType = new QName(ns, name);
registry.registerDeserializer(parentType, elementType, helper);
registry.registerSerializer(parentType, elementType, helper);
registry.mapExtensionTypes(parentType, elementType, cls);