users@jaxb.java.net

s2j: get the java type for a qname generically

From: पंकज एम तोलानी <pankaj.tolani_at_gmail.com>
Date: Fri, 25 Jul 2008 11:04:47 +0530

I compile schemas in WSDL/XSD using JAXB. Later in my generated java
interfaces corresponding to WSDL porttype, I need to get the java type class
file to be imported for an element/type in the XSD.

How do I achieve this?

String fullJavaName =
NameConverter.smart.toPackageName(name.getNamespaceURI()) + "."
            + NameConverter.smart.toClassName(name.getLocalPart());

works for elements with complex types, where name is the QName.

But does not work for simple type, element with simple type.

JAXBModel says this

public TypeAndAnnotation getJavaType(QName xmlTypeName) {
        *// TODO: primitive type handling?*
        TypeUse use = model.typeUses().get(xmlTypeName);
        if(use==null) return null;

        return new TypeAndAnnotationImpl(outline,use);
    }

thanks,
pankaj

-- 
पंकज एम तोलानी