42 lines
1004 B
Java
42 lines
1004 B
Java
package net.tomatentum.cutin;
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
import net.tomatentum.cutin.method.ReflectedMethod;
|
|
|
|
public class TestReflectedMethod extends ReflectedMethod<String, String> {
|
|
|
|
protected TestReflectedMethod(Object containingObject) {
|
|
super(getMethod(containingObject), containingObject);
|
|
|
|
}
|
|
|
|
@Override
|
|
public Object getParameter(String context, int index) {
|
|
switch (index) {
|
|
case 0:
|
|
return context;
|
|
case 1:
|
|
return 2;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public String identifier() {
|
|
return method().getName();
|
|
}
|
|
|
|
private static Method getMethod(Object containingObject) {
|
|
try {
|
|
return containingObject.getClass().getDeclaredMethod("test", String.class, int.class);
|
|
} catch (NoSuchMethodException | SecurityException e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
}
|