String db = dataType.getDataBinding();
while ("java:array".equals(db)) {
dataType = (DataType)dataType.getLogical();
db = dataType.getDataBinding();
}
XMLTypeHelper helper = helpers.get(db);
if (helper == null) {
DataBinding dataBinding = dataBindings.getDataBinding(db);
if (dataBinding == null) {
QName element = name;
if (element == null || dataType.getLogical() instanceof XMLType) {
XMLType xmlType = (XMLType)dataType.getLogical();
if (xmlType.getElementName() != null) {
element = xmlType.getElementName();
}
}
return new ElementInfo(element, new TypeInfo(ANYTYPE_QNAME, false, null));
// throw new ServiceRuntimeException("No data binding for " + db);
}
helper = dataBinding.getXMLTypeHelper();
if (helper == null) {
// Default to JAXB
helper = helpers.get(JAXBDataBinding.NAME);
if (helper == null) {
helper = dataBindings.getDataBinding(JAXBDataBinding.NAME).getXMLTypeHelper();
helpers.put(JAXBDataBinding.NAME, helper);
}
}
helpers.put(db, helper);
}
// TUSCANY-3616 - don't revert a byte[] to a byte type but retain the mapping to base64Binary
// which is carried in the dataType and the original javaType
TypeInfo typeInfo = null;
ElementInfo element = null;
if (byte[].class == javaType){
typeInfo = helper.getTypeInfo(javaType, dataType.getLogical());
element = new ElementInfo(name, typeInfo);
element.setMany(false);
} else {
typeInfo = helper.getTypeInfo(javaType.isArray() ? javaType.getComponentType() : javaType, dataType.getLogical());
element = new ElementInfo(name, typeInfo);
element.setMany(javaType.isArray());
}
element.setNillable(!javaType.isPrimitive());