XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, true);
ct.setName(faultTypeName);
el.setSchemaTypeName(ct.getQName());
XmlSchemaSequence seq = new XmlSchemaSequence();
ct.setParticle(seq);
String namespace = part.getElementQName().getNamespaceURI();
XmlAccessType accessType = Utils.getXmlAccessType(cls);
//
for (Field f : Utils.getFields(cls, accessType)) {
//map field
Type type = Utils.getFieldType(f);
//we want to return the right type for collections so if we get null
//from the return type we check if it's ParameterizedType and get the
//generic return type.
if ((type == null) && (f.getGenericType() instanceof ParameterizedType)) {
type = f.getGenericType();
}
JAXBBeanInfo beanInfo = getBeanInfo(type);
if (beanInfo != null) {
addElement(schema, seq, beanInfo, new QName(namespace, f.getName()), isArray(type));
}
}
for (Method m : Utils.getGetters(cls, accessType)) {
//map method
Type type = Utils.getMethodReturnType(m);
// we want to return the right type for collections so if we get null
// from the return type we check if it's ParameterizedType and get the
// generic return type.
if ((type == null) && (m.getGenericReturnType() instanceof ParameterizedType)) {
type = m.getGenericReturnType();
}
JAXBBeanInfo beanInfo = getBeanInfo(type);
if (beanInfo != null) {
int idx = m.getName().startsWith("get") ? 3 : 2;
String name = m.getName().substring(idx);
name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
addElement(schema, seq, beanInfo, new QName(namespace, name), isArray(type));
}
}
// Create element in xsd:sequence for Exception.class
if (cls.equals(Exception.class)) {
JAXBBeanInfo beanInfo = getBeanInfo(java.lang.String.class);
XmlSchemaElement exEle = new XmlSchemaElement(schema, false);
exEle.setName("message");
exEle.setSchemaTypeName(getTypeName(beanInfo));
exEle.setMinOccurs(0);
seq.getItems().add(exEle);
}
if (propertyOrder != null && propertyOrder.length == seq.getItems().size()) {
sortItems(seq, propertyOrder);
} else if (propertyOrder != null && propertyOrder.length != seq.getItems().size()) {
LOG.log(Level.WARNING, "propOrder in @XmlType doesn't define all schema elements :"
+ Arrays.toString(propertyOrder));
}
if (xmlAccessorOrder != null && xmlAccessorOrder.value().equals(XmlAccessOrder.ALPHABETICAL)