fix полечение метода
This commit is contained in:
@@ -84,15 +84,39 @@ public class ReflectionObject {
|
||||
}
|
||||
}
|
||||
|
||||
public List<ReflectionMethod> methodsAllList() {
|
||||
final Class clazz = object.getClass();
|
||||
|
||||
Method[] declaredMethods = clazz.getMethods();
|
||||
if (declaredMethods.length > 0) {
|
||||
List<ReflectionMethod> result = new ArrayList<>(declaredMethods.length);
|
||||
|
||||
for (Method method : declaredMethods) {
|
||||
result.add(new ReflectionMethod(object, method));
|
||||
}
|
||||
|
||||
return result;
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ReflectionMethod method(String methodName, Class<?>... parameterTypes) {
|
||||
final Class clazz = object.getClass();
|
||||
|
||||
Method method;
|
||||
try {
|
||||
return new ReflectionMethod(object, clazz.getDeclaredMethod(methodName, parameterTypes));
|
||||
method = clazz.getDeclaredMethod(methodName, parameterTypes);
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new ReflectionException(e);
|
||||
try {
|
||||
method = clazz.getMethod(methodName, parameterTypes);
|
||||
} catch (NoSuchMethodException e1) {
|
||||
throw new ReflectionException(e1);
|
||||
}
|
||||
}
|
||||
|
||||
return new ReflectionMethod(object, method);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user