String javatype;
String createtype = null;
if (element.getSchemaType() instanceof XmlSchemaSimpleType) {
// simple type translates to format element in binding
FormatElement format = (FormatElement)simpleTypeMap.get(typename);
if (format == null) {
// check for restriction with simple base, and treat as base if so
XmlSchemaSimpleType stype = (XmlSchemaSimpleType)element.getSchemaType();
XmlSchemaSimpleTypeContent content = stype.getContent();
if (content instanceof XmlSchemaSimpleTypeRestriction) {
QName tname = ((XmlSchemaSimpleTypeRestriction)content).getBaseTypeName();
if (SCHEMA_NAMESPACE.equals(tname.getNamespaceURI())) {
format = (FormatElement)simpleTypeMap.get(tname);
if (format != null) {
typename = tname;
}
}
}
}
if (format == null) {
throw new RuntimeException("Cannot unwrap element " +
qname + ": no format definition found for type " +
typename + " (used by element " + itemname + ')');
}
javatype = format.getTypeName();
param.setAttribute("form", "simple");
param.setAttribute("serializer", format.getSerializerName());
param.setAttribute("deserializer", format.getDeserializerName());
// convert primitive types to wrapper types for nillable
if ((optional || element.isNillable()) &&
s_wrapperMap.containsKey(javatype)) {
param.setAttribute("wrapped-primitive", "true");
param.setAttribute("value-method", javatype + "Value");
javatype = (String)s_wrapperMap.get(javatype);
} else {
param.setAttribute("wrapped-primitive", "false");
String dflt = element.getDefaultValue();
if (dflt == null) {
dflt = format.getDefaultText();
if (javatype.equals("float")) {
dflt = dflt + 'F';
}
}
if (dflt != null) {