* @param s
* @param el
*/
private BeehiveWsParameterMetadata elementToParamMetaData(
String targetNamespace, Element el) {
BeehiveWsParameterMetadata wpm = new Jsr181ParameterMetadataImpl();
// FIXME
// jcolwell@bea.com
// 2004-Nov-09
// double check the
// namespace stuff
wpm.setWpTargetNamespace(targetNamespace);
boolean isArray = false;
if (el.isSetMaxOccurs()) {
if (0 != "1".compareTo(el.getMaxOccurs().toString()))
isArray = true;
} else if (el.isSetMinOccurs()) {
String minOccur = el.getMinOccurs().toString();
// If minoccur is other than 0, or 1 then it is array also
if ("0" != minOccur && "1" != minOccur)
isArray = true;
}
String name = null;
QName xmlType = null;
if (el.isSetName() && el.isSetType()) {
name = el.getName();
xmlType = el.getType();
} else if (el.isSetRef()) {
QName ref = el.getRef();
name = ref.getLocalPart();
xmlType = ref;
} else
throw new RuntimeException("invalid element: " + el);
Class javaType = findClassForQname(xmlType);
if (isArray) {
// create an array of the type, then get its type.
Object realType = Array.newInstance(javaType, 1);
javaType = realType.getClass();
}
wpm.setWpName(name);
wpm.setXmlType(xmlType);
wpm.setJavaType(javaType);
return wpm;
}