
com.github.julior.appintrospector.MethodInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of app-introspector Show documentation
Show all versions of app-introspector Show documentation
A simple Spring plugin to diagnostic and inspect Spring beans at runtime. It provides JSON based services
as well as an UI based Console to execute queries and scripts against the application.
The newest version!
package com.github.julior.appintrospector;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/**
* User: rinconj
* Date: 9/22/11 11:44 AM
*/
public class MethodInfo{
private String name;
private String[] paramTypes;
private String returnType;
MethodInfo(String name, String[] paramTypes, String returnType) {
this.name = name;
this.paramTypes = paramTypes;
this.returnType = returnType;
}
static MethodInfo create(Method method) {
List paramTypes = new ArrayList();
for(Class clazz : method.getParameterTypes()){
paramTypes.add(clazz.getSimpleName());
}
Class returnType = method.getReturnType();
return new MethodInfo(method.getName(), paramTypes.toArray(new String[0]), returnType==null?"void" :returnType.getSimpleName());
}
public String getName() {
return name;
}
public String[] getParamTypes() {
return paramTypes;
}
public String getReturnType() {
return returnType;
}
}