use of commonj.sdo.helper.XSDHelper in project metro-jax-ws by eclipse-ee4j.
the class Xsd2JavaSDOModel method getJavaTypeForElementName.
/**
* return the java type used for the element, only Global elements can be located.
* Containing types are not searched
*/
public String getJavaTypeForElementName(QName qname) {
XSDHelper xsdHelper = context.getXSDHelper();
Property globalProperty = xsdHelper.getGlobalProperty(qname.getNamespaceURI(), qname.getLocalPart(), true);
if (globalProperty == null) {
throw new RuntimeException("Given element with name: " + qname + "is not found.");
}
Type elementType = globalProperty.getType();
if (elementType == null) {
throw new RuntimeException("Given element with name: " + qname + "is not found.");
}
return ((SDOType) elementType).getInstanceClassName();
}
use of commonj.sdo.helper.XSDHelper in project eclipselink by eclipse-ee4j.
the class RedefineTestCases method doTest.
private void doTest(String resource, int numberOfTypes) throws Exception {
SDOHelperContext sdoHelperContext = new SDOHelperContext();
XSDHelper xsdHelper = sdoHelperContext.getXSDHelper();
InputStream xsd;
List types;
xsd = getSchema(resource);
types = xsdHelper.define(xsd, null);
assertEquals(numberOfTypes, types.size());
xsd.close();
xsd = getSchema(resource);
types = xsdHelper.define(xsd, null);
assertEquals(0, types.size());
xsd.close();
}
use of commonj.sdo.helper.XSDHelper in project metro-jax-ws by eclipse-ee4j.
the class SDOUtils method getPropertyElementName.
/**
* get the element name represented by this property
*/
public static QName getPropertyElementName(HelperContext context, Property p) {
XSDHelper helper = context.getXSDHelper();
String localName = p.getName();
String ns = helper.getNamespaceURI(p);
return new QName(ns, localName);
}
use of commonj.sdo.helper.XSDHelper in project metro-jax-ws by eclipse-ee4j.
the class SDOContextWrapper method getTypeName.
@Override
public QName getTypeName(TypeInfo tr) {
QName res = model.getXsdTypeName(((Class<?>) tr.type).getName());
if (res != null) {
return res;
}
HelperContext hc = contextResolver.getHelperContext(isClient, serviceName, properties);
TypeHelper th = hc.getTypeHelper();
Type t = th.getType((Class<?>) tr.type);
XSDHelper helper = hc.getXSDHelper();
String localName = helper.getLocalName(t);
String namespaceURI = helper.getNamespaceURI(t);
if (namespaceURI == null) {
namespaceURI = t.getURI();
}
if (localName == null) {
localName = t.getName();
}
return new QName(namespaceURI == null ? "" : namespaceURI, localName);
}
Aggregations