Widening.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4683 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -35,17 +35,15 @@ import com.threerings.presents.Log;
|
|||||||
public class ClassUtil
|
public class ClassUtil
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Locates and returns the first method in the supplied class whose
|
* Locates and returns the first method in the supplied class whose name is equal to the
|
||||||
* name is equal to the specified name. If a method is located, it
|
* specified name. If a method is located, it will be cached in the supplied cache so that
|
||||||
* will be cached in the supplied cache so that subsequent requests
|
* subsequent requests will immediately return the method from the cache rather than
|
||||||
* will immediately return the method from the cache rather than
|
|
||||||
* re-reflecting.
|
* re-reflecting.
|
||||||
*
|
*
|
||||||
* @return the method with the specified name or null if no method
|
* @return the method with the specified name or null if no method with that name could be
|
||||||
* with that name could be found.
|
* found.
|
||||||
*/
|
*/
|
||||||
public static Method getMethod (
|
public static Method getMethod (String name, Object target, HashMap<String,Method> cache)
|
||||||
String name, Object target, HashMap<String,Method> cache)
|
|
||||||
{
|
{
|
||||||
Class tclass = target.getClass();
|
Class tclass = target.getClass();
|
||||||
String key = tclass.getName() + ":" + name;
|
String key = tclass.getName() + ":" + name;
|
||||||
@@ -62,14 +60,12 @@ public class ClassUtil
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks up the method on the specified object that has a signature
|
* Looks up the method on the specified object that has a signature that matches the supplied
|
||||||
* that matches the supplied arguments array. This is very expensive,
|
* arguments array. This is very expensive, so you shouldn't be doing this for something that
|
||||||
* so you shouldn't be doing this for something that happens
|
* happens frequently.
|
||||||
* frequently.
|
|
||||||
*
|
*
|
||||||
* @return the best matching method with the specified name that
|
* @return the best matching method with the specified name that accepts the supplied
|
||||||
* accepts the supplied arguments, or null if no method could be
|
* arguments, or null if no method could be found.
|
||||||
* found.
|
|
||||||
*
|
*
|
||||||
* @see MethodFinder
|
* @see MethodFinder
|
||||||
*/
|
*/
|
||||||
@@ -84,14 +80,11 @@ public class ClassUtil
|
|||||||
|
|
||||||
} catch (NoSuchMethodException nsme) {
|
} catch (NoSuchMethodException nsme) {
|
||||||
// nothing to do here but fall through and return null
|
// nothing to do here but fall through and return null
|
||||||
Log.info("No such method [name=" + name +
|
Log.info("No such method [name=" + name + ", tclass=" + tclass.getName() +
|
||||||
", tclass=" + tclass.getName() +
|
", args=" + StringUtil.toString(args) + ", error=" + nsme + "].");
|
||||||
", args=" + StringUtil.toString(args) +
|
|
||||||
", error=" + nsme + "].");
|
|
||||||
|
|
||||||
} catch (SecurityException se) {
|
} catch (SecurityException se) {
|
||||||
Log.warning("Unable to look up method? " +
|
Log.warning("Unable to look up method? [tclass=" + tclass.getName() +
|
||||||
"[tclass=" + tclass.getName() +
|
|
||||||
", mname=" + name + "].");
|
", mname=" + name + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,11 +92,11 @@ public class ClassUtil
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locates and returns the first method in the supplied class whose
|
* Locates and returns the first method in the supplied class whose name is equal to the
|
||||||
* name is equal to the specified name.
|
* specified name.
|
||||||
*
|
*
|
||||||
* @return the method with the specified name or null if no method
|
* @return the method with the specified name or null if no method with that name could be
|
||||||
* with that name could be found.
|
* found.
|
||||||
*/
|
*/
|
||||||
public static Method findMethod (Class clazz, String name)
|
public static Method findMethod (Class clazz, String name)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user