|
|
@@ -14,6 +14,7 @@ import java.util.*;
|
|
|
import javax.jws.WebMethod;
|
|
|
import javax.jws.WebParam;
|
|
|
import javax.jws.WebResult;
|
|
|
+import net.ranides.assira.asm.MethodInspector;
|
|
|
import net.ranides.assira.collection.ArrayUtils;
|
|
|
import net.ranides.assira.text.Strings;
|
|
|
|
|
|
@@ -27,7 +28,8 @@ public class WebServiceMethod {
|
|
|
private final WebMethod info;
|
|
|
private final String result;
|
|
|
|
|
|
- private final Map<String, Class<?>> params = new LinkedHashMap<String, Class<?>>();
|
|
|
+ private final Map<String, GenericClass> params = new LinkedHashMap<String, GenericClass>();
|
|
|
+ private final Map<String, String> webParams = new LinkedHashMap<String, String>();
|
|
|
|
|
|
WebServiceMethod(Method method) {
|
|
|
this.method = method;
|
|
|
@@ -40,15 +42,18 @@ public class WebServiceMethod {
|
|
|
WebResult iresult = method.getAnnotation(WebResult.class);
|
|
|
this.result = (null==iresult) ? null : iresult.name();
|
|
|
|
|
|
- Annotation[][] metaParams = method.getParameterAnnotations();
|
|
|
- Class<?>[] typeParams = method.getParameterTypes();
|
|
|
-
|
|
|
- for (int i = 0, n=typeParams.length; i < n; i++) {
|
|
|
- WebParam paramInfo = ArrayUtils.first(metaParams[i], WebParam.class);
|
|
|
+ Annotation[][] paramInfos = method.getParameterAnnotations();
|
|
|
+ Class<?>[] paramTypes = method.getParameterTypes();
|
|
|
+
|
|
|
+ int index = 0;
|
|
|
+ for(Variable param : MethodInspector.getArguments(method)) {
|
|
|
+ params.put(param.name(), param.type());
|
|
|
+ WebParam paramInfo = ArrayUtils.first(paramInfos[index], WebParam.class);
|
|
|
if (null == paramInfo) {
|
|
|
- throw new IncompleteAnnotationException(WebParam.class, method.getDeclaringClass().getCanonicalName() + "." + method.getName() );
|
|
|
+ webParams.put(param.name(), param.type().asText());
|
|
|
+ } else {
|
|
|
+ webParams.put(paramInfo.name(), param.type().asText());
|
|
|
}
|
|
|
- params.put(paramInfo.name(), typeParams[i]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -72,12 +77,12 @@ public class WebServiceMethod {
|
|
|
return Strings.orne(result, method.getReturnType().getSimpleName());
|
|
|
}
|
|
|
|
|
|
-// public Map<String, String> getParamsMap() {
|
|
|
-// return Collections.unmodifiableMap(params);
|
|
|
-// }
|
|
|
-//
|
|
|
-// public List< Entry<String,String> > getParamsList() {
|
|
|
-// return new LinkedList< Entry<String,String> >( params.entrySet() );
|
|
|
-// }
|
|
|
+ public Map<String, GenericClass> getParamTypes() {
|
|
|
+ return Collections.unmodifiableMap(params);
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, String> getParams() {
|
|
|
+ return Collections.unmodifiableMap(webParams);
|
|
|
+ }
|
|
|
|
|
|
}
|