case PATH:
p = new Param();
p.setStyle(ParamStyle.TEMPLATE);
for (Annotation a : annotations) {
if (PathParam.class.equals(a.annotationType())) {
PathParam paramAnn = (PathParam)a;
p.setName(paramAnn.value());
}
}
break;
case QUERY:
p = new Param();
p.setStyle(ParamStyle.QUERY);
for (Annotation a : annotations) {
if (QueryParam.class.equals(a.annotationType())) {
QueryParam paramAnn = (QueryParam)a;
p.setName(paramAnn.value());
}
}
break;
case FORM:
p = new Param();
p.setStyle(ParamStyle.QUERY);
for (Annotation a : annotations) {
if (FormParam.class.equals(a.annotationType())) {
FormParam paramAnn = (FormParam)a;
p.setName(paramAnn.value());
}
}
break;
case CONTEXT:
break;
case COOKIE:
break;
case ENTITY:
break;
}
if (p == null) {
/*
* The paramtype was never set so return null. This might have been
* some other type of injectable that shouldn't be created as a
* Param. This is a preventive measure.
*/
return null;
}
Class<?> memberType = paramMetadata.getType();
if (memberType.equals(int.class) || memberType.equals(Integer.class)) {
p.setType(new QName(XML_SCHEMA_NS, "int"));
} else if (memberType.equals(float.class) || memberType.equals(Float.class)) {
p.setType(new QName(XML_SCHEMA_NS, "float"));
} else if (memberType.equals(long.class) || memberType.equals(Long.class)) {
p.setType(new QName(XML_SCHEMA_NS, "long"));
} else if (memberType.equals(boolean.class) || memberType.equals(Boolean.class)) {
p.setType(new QName(XML_SCHEMA_NS, "boolean"));
} else if (memberType.equals(short.class) || memberType.equals(Short.class)) {
p.setType(new QName(XML_SCHEMA_NS, "short"));
} else if (memberType.equals(double.class) || memberType.equals(Double.class)) {
p.setType(new QName(XML_SCHEMA_NS, "double"));
} else if (memberType.equals(byte.class) || memberType.equals(Byte.class)) {
p.setType(new QName(XML_SCHEMA_NS, "byte"));
}
for (Annotation a : annotations) {
if (DefaultValue.class.equals(a.annotationType())) {
DefaultValue paramAnn = (DefaultValue)a;
p.setDefault(paramAnn.value());
}
if (WADLDoc.class.equals(a.annotationType())) {
WADLDoc d = (WADLDoc)a;
p.getDoc().add(getDocument(d));