📄 methodref.java
字号:
package jws.lang;
// Copyright 1997, John Webster Small
// All rights Reserved
import java.lang.reflect.*;
public final class MethodRef
{
private final Object ref;
private final Method method;
public MethodRef
(Object ref, String name, Class[] parameterTypes)
throws NoSuchMethodException, SecurityException
{
this.ref = ref;
method = ref.getClass().getMethod(name,parameterTypes);
}
public MethodRef(Object ref, String name)
throws NoSuchMethodException, SecurityException
{
this.ref = ref;
method = ref.getClass().getMethod(name,new Class[0]);
}
public final Object invoke(Object[] args)
throws IllegalAccessException,
IllegalArgumentException,
InvocationTargetException
{ return method.invoke(ref,args); }
public final Object invoke()
throws IllegalAccessException,
IllegalArgumentException,
InvocationTargetException
{ return method.invoke(ref,new Object[0]); }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -