2012-09-18 17:27:59 +02:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
< html lang = "en" >
< head >
2012-10-11 03:00:53 +02:00
<!-- Generated by javadoc (version 1.7.0_07) on Thu Oct 11 02:58:30 CEST 2012 -->
2012-09-18 17:27:59 +02:00
< title > MethodUtils< / title >
2012-10-11 03:00:53 +02:00
< meta name = "date" content = "2012-10-11" >
2012-09-18 17:27:59 +02:00
< link rel = "stylesheet" type = "text/css" href = "../../../../stylesheet.css" title = "Style" >
< / head >
< body >
< script type = "text/javascript" > < ! - -
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="MethodUtils";
}
//-->
< / script >
< noscript >
< div > JavaScript is disabled on your browser.< / div >
< / noscript >
<!-- ========= START OF TOP NAVBAR ======= -->
< div class = "topNav" > < a name = "navbar_top" >
<!-- -->
< / a > < a href = "#skip-navbar_top" title = "Skip navigation links" > < / a > < a name = "navbar_top_firstrow" >
<!-- -->
< / a >
< ul class = "navList" title = "Navigation" >
< li > < a href = "../../../../overview-summary.html" > Overview< / a > < / li >
< li > < a href = "package-summary.html" > Package< / a > < / li >
< li class = "navBarCell1Rev" > Class< / li >
< li > < a href = "class-use/MethodUtils.html" > Use< / a > < / li >
< li > < a href = "package-tree.html" > Tree< / a > < / li >
< li > < a href = "../../../../deprecated-list.html" > Deprecated< / a > < / li >
< li > < a href = "../../../../index-files/index-1.html" > Index< / a > < / li >
< li > < a href = "../../../../help-doc.html" > Help< / a > < / li >
< / ul >
< / div >
< div class = "subNav" >
< ul class = "navList" >
< li > < a href = "../../../../com/comphenix/protocol/reflect/IntEnum.html" title = "class in com.comphenix.protocol.reflect" > < span class = "strong" > Prev Class< / span > < / a > < / li >
2012-10-05 04:45:17 +02:00
< li > < a href = "../../../../com/comphenix/protocol/reflect/ObjectCloner.html" title = "class in com.comphenix.protocol.reflect" > < span class = "strong" > Next Class< / span > < / a > < / li >
2012-09-18 17:27:59 +02:00
< / ul >
< ul class = "navList" >
< li > < a href = "../../../../index.html?com/comphenix/protocol/reflect/MethodUtils.html" target = "_top" > Frames< / a > < / li >
< li > < a href = "MethodUtils.html" target = "_top" > No Frames< / a > < / li >
< / ul >
< ul class = "navList" id = "allclasses_navbar_top" >
< li > < a href = "../../../../allclasses-noframe.html" > All Classes< / a > < / li >
< / ul >
< div >
< script type = "text/javascript" > < ! - -
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
< / script >
< / div >
< div >
< ul class = "subNavList" >
< li > Summary: < / li >
< li > Nested | < / li >
< li > Field | < / li >
< li > < a href = "#constructor_summary" > Constr< / a > | < / li >
< li > < a href = "#method_summary" > Method< / a > < / li >
< / ul >
< ul class = "subNavList" >
< li > Detail: < / li >
< li > Field | < / li >
< li > < a href = "#constructor_detail" > Constr< / a > | < / li >
< li > < a href = "#method_detail" > Method< / a > < / li >
< / ul >
< / div >
< a name = "skip-navbar_top" >
<!-- -->
< / a > < / div >
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
< div class = "header" >
< div class = "subTitle" > com.comphenix.protocol.reflect< / div >
< h2 title = "Class MethodUtils" class = "title" > Class MethodUtils< / h2 >
< / div >
< div class = "contentContainer" >
< ul class = "inheritance" >
< li > java.lang.Object< / li >
< li >
< ul class = "inheritance" >
< li > com.comphenix.protocol.reflect.MethodUtils< / li >
< / ul >
< / li >
< / ul >
< div class = "description" >
< ul class = "blockList" >
< li class = "blockList" >
< hr >
< br >
< pre > public class < span class = "strong" > MethodUtils< / span >
extends java.lang.Object< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Utility reflection methods focussed on methods in general rather than properties in particular. < / p >
< h3 > Known Limitations< / h3 >
< h4 > Accessing Public Methods In A Default Access Superclass< / h4 >
< p > There is an issue when invoking public methods contained in a default access superclass.
Reflection locates these methods fine and correctly assigns them as public.
However, an < code > IllegalAccessException< / code > is thrown if the method is invoked.< / p >
< p > < code > MethodUtils< / code > contains a workaround for this situation.
It will attempt to call < code > setAccessible< / code > on this method.
If this call succeeds, then the method can be invoked as normal.
This call will only succeed when the application has sufficient security privilages.
2012-09-18 17:27:59 +02:00
If this call fails then a warning will be logged and the method may fail.< / p > < / div >
< dl > < dt > < span class = "strong" > Author:< / span > < / dt >
< dd > Craig R. McClanahan, Ralph Schaer, Chris Audley, Rey Franç ois, Gregor Raý man, Jan Sorensen, Robert Burrell Donkin< / dd > < / dl >
< / li >
< / ul >
< / div >
< div class = "summary" >
< ul class = "blockList" >
< li class = "blockList" >
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
< ul class = "blockList" >
< li class = "blockList" > < a name = "constructor_summary" >
<!-- -->
< / a >
< h3 > Constructor Summary< / h3 >
< table class = "overviewSummary" border = "0" cellpadding = "3" cellspacing = "0" summary = "Constructor Summary table, listing constructors, and an explanation" >
< caption > < span > Constructors< / span > < span class = "tabEnd" > < / span > < / caption >
< tr >
< th class = "colOne" scope = "col" > Constructor and Description< / th >
< / tr >
< tr class = "altColor" >
< td class = "colOne" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#MethodUtils()" > MethodUtils< / a > < / strong > ()< / code > < / td >
< / tr >
< / table >
< / li >
< / ul >
<!-- ========== METHOD SUMMARY =========== -->
< ul class = "blockList" >
< li class = "blockList" > < a name = "method_summary" >
<!-- -->
< / a >
< h3 > Method Summary< / h3 >
< table class = "overviewSummary" border = "0" cellpadding = "3" cellspacing = "0" summary = "Method Summary table, listing methods, and an explanation" >
< caption > < span > Methods< / span > < span class = "tabEnd" > < / span > < / caption >
< tr >
< th class = "colFirst" scope = "col" > Modifier and Type< / th >
< th class = "colLast" scope = "col" > Method and Description< / th >
< / tr >
< tr class = "altColor" >
< td class = "colFirst" > < code > static int< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#clearCache()" > clearCache< / a > < / strong > ()< / code >
< div class = "block" > Clear the method cache.< / div >
< / td >
< / tr >
< tr class = "rowColor" >
< td class = "colFirst" > < code > static java.lang.reflect.Method< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#getAccessibleMethod(java.lang.Class, java.lang.reflect.Method)" > getAccessibleMethod< / a > < / strong > (java.lang.Class clazz,
java.lang.reflect.Method method)< / code >
2012-10-17 07:58:24 +02:00
< div class = "block" > Return an accessible method (that is, one that can be invoked via
2012-09-18 17:27:59 +02:00
reflection) that implements the specified Method.< / div >
< / td >
< / tr >
< tr class = "altColor" >
< td class = "colFirst" > < code > static java.lang.reflect.Method< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#getAccessibleMethod(java.lang.Class, java.lang.String, java.lang.Class[])" > getAccessibleMethod< / a > < / strong > (java.lang.Class clazz,
java.lang.String methodName,
java.lang.Class[] parameterTypes)< / code >
2012-10-17 07:58:24 +02:00
< div class = "block" > Return an accessible method (that is, one that can be invoked via
2012-09-18 17:27:59 +02:00
reflection) with given name and parameters.< / div >
< / td >
< / tr >
< tr class = "rowColor" >
< td class = "colFirst" > < code > static java.lang.reflect.Method< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#getAccessibleMethod(java.lang.reflect.Method)" > getAccessibleMethod< / a > < / strong > (java.lang.reflect.Method method)< / code >
2012-10-17 07:58:24 +02:00
< div class = "block" > Return an accessible method (that is, one that can be invoked via
2012-09-18 17:27:59 +02:00
reflection) that implements the specified Method.< / div >
< / td >
< / tr >
< tr class = "altColor" >
< td class = "colFirst" > < code > static java.lang.reflect.Method< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#getMatchingAccessibleMethod(java.lang.Class, java.lang.String, java.lang.Class[])" > getMatchingAccessibleMethod< / a > < / strong > (java.lang.Class clazz,
java.lang.String methodName,
java.lang.Class[] parameterTypes)< / code >
< div class = "block" > Find an accessible method that matches the given name and has compatible parameters.< / div >
< / td >
< / tr >
< tr class = "rowColor" >
< td class = "colFirst" > < code > static java.lang.Class< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#getPrimitiveType(java.lang.Class)" > getPrimitiveType< / a > < / strong > (java.lang.Class wrapperType)< / code >
< div class = "block" > Gets the class for the primitive type corresponding to the primitive wrapper class given.< / div >
< / td >
< / tr >
< tr class = "altColor" >
< td class = "colFirst" > < code > static java.lang.Class< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#getPrimitiveWrapper(java.lang.Class)" > getPrimitiveWrapper< / a > < / strong > (java.lang.Class primitiveType)< / code >
< div class = "block" > Gets the wrapper object class for the given primitive type class.< / div >
< / td >
< / tr >
< tr class = "rowColor" >
< td class = "colFirst" > < code > static java.lang.Object< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactMethod(java.lang.Object, java.lang.String, java.lang.Object)" > invokeExactMethod< / a > < / strong > (java.lang.Object object,
java.lang.String methodName,
java.lang.Object arg)< / code >
2012-10-17 07:58:24 +02:00
< div class = "block" > Invoke a method whose parameter type matches exactly the object
2012-09-18 17:27:59 +02:00
type.< / div >
< / td >
< / tr >
< tr class = "altColor" >
< td class = "colFirst" > < code > static java.lang.Object< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactMethod(java.lang.Object, java.lang.String, java.lang.Object[])" > invokeExactMethod< / a > < / strong > (java.lang.Object object,
java.lang.String methodName,
java.lang.Object[] args)< / code >
2012-10-17 07:58:24 +02:00
< div class = "block" > Invoke a method whose parameter types match exactly the object
2012-09-18 17:27:59 +02:00
types.< / div >
< / td >
< / tr >
< tr class = "rowColor" >
< td class = "colFirst" > < code > static java.lang.Object< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactMethod(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Class[])" > invokeExactMethod< / a > < / strong > (java.lang.Object object,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.Class[] parameterTypes)< / code >
2012-10-17 07:58:24 +02:00
< div class = "block" > Invoke a method whose parameter types match exactly the parameter
2012-09-18 17:27:59 +02:00
types given.< / div >
< / td >
< / tr >
< tr class = "altColor" >
< td class = "colFirst" > < code > static java.lang.Object< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactStaticMethod(java.lang.Class, java.lang.String, java.lang.Object)" > invokeExactStaticMethod< / a > < / strong > (java.lang.Class objectClass,
java.lang.String methodName,
java.lang.Object arg)< / code >
2012-10-17 07:58:24 +02:00
< div class = "block" > Invoke a static method whose parameter type matches exactly the object
2012-09-18 17:27:59 +02:00
type.< / div >
< / td >
< / tr >
< tr class = "rowColor" >
< td class = "colFirst" > < code > static java.lang.Object< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactStaticMethod(java.lang.Class, java.lang.String, java.lang.Object[])" > invokeExactStaticMethod< / a > < / strong > (java.lang.Class objectClass,
java.lang.String methodName,
java.lang.Object[] args)< / code >
2012-10-17 07:58:24 +02:00
< div class = "block" > Invoke a static method whose parameter types match exactly the object
2012-09-18 17:27:59 +02:00
types.< / div >
< / td >
< / tr >
< tr class = "altColor" >
< td class = "colFirst" > < code > static java.lang.Object< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactStaticMethod(java.lang.Class, java.lang.String, java.lang.Object[], java.lang.Class[])" > invokeExactStaticMethod< / a > < / strong > (java.lang.Class objectClass,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.Class[] parameterTypes)< / code >
2012-10-17 07:58:24 +02:00
< div class = "block" > Invoke a static method whose parameter types match exactly the parameter
2012-09-18 17:27:59 +02:00
types given.< / div >
< / td >
< / tr >
< tr class = "rowColor" >
< td class = "colFirst" > < code > static java.lang.Object< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeMethod(java.lang.Object, java.lang.String, java.lang.Object)" > invokeMethod< / a > < / strong > (java.lang.Object object,
java.lang.String methodName,
java.lang.Object arg)< / code >
< div class = "block" > Invoke a named method whose parameter type matches the object type.< / div >
< / td >
< / tr >
< tr class = "altColor" >
< td class = "colFirst" > < code > static java.lang.Object< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeMethod(java.lang.Object, java.lang.String, java.lang.Object[])" > invokeMethod< / a > < / strong > (java.lang.Object object,
java.lang.String methodName,
java.lang.Object[] args)< / code >
< div class = "block" > Invoke a named method whose parameter type matches the object type.< / div >
< / td >
< / tr >
< tr class = "rowColor" >
< td class = "colFirst" > < code > static java.lang.Object< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeMethod(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Class[])" > invokeMethod< / a > < / strong > (java.lang.Object object,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.Class[] parameterTypes)< / code >
< div class = "block" > Invoke a named method whose parameter type matches the object type.< / div >
< / td >
< / tr >
< tr class = "altColor" >
< td class = "colFirst" > < code > static java.lang.Object< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeStaticMethod(java.lang.Class, java.lang.String, java.lang.Object)" > invokeStaticMethod< / a > < / strong > (java.lang.Class objectClass,
java.lang.String methodName,
java.lang.Object arg)< / code >
< div class = "block" > Invoke a named static method whose parameter type matches the object type.< / div >
< / td >
< / tr >
< tr class = "rowColor" >
< td class = "colFirst" > < code > static java.lang.Object< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeStaticMethod(java.lang.Class, java.lang.String, java.lang.Object[])" > invokeStaticMethod< / a > < / strong > (java.lang.Class objectClass,
java.lang.String methodName,
java.lang.Object[] args)< / code >
< div class = "block" > Invoke a named static method whose parameter type matches the object type.< / div >
< / td >
< / tr >
< tr class = "altColor" >
< td class = "colFirst" > < code > static java.lang.Object< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeStaticMethod(java.lang.Class, java.lang.String, java.lang.Object[], java.lang.Class[])" > invokeStaticMethod< / a > < / strong > (java.lang.Class objectClass,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.Class[] parameterTypes)< / code >
< div class = "block" > Invoke a named static method whose parameter type matches the object type.< / div >
< / td >
< / tr >
< tr class = "rowColor" >
< td class = "colFirst" > < code > static boolean< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#isAssignmentCompatible(java.lang.Class, java.lang.Class)" > isAssignmentCompatible< / a > < / strong > (java.lang.Class parameterType,
java.lang.Class parameterization)< / code >
< div class = "block" > Determine whether a type can be used as a parameter in a method invocation.< / div >
< / td >
< / tr >
< tr class = "altColor" >
< td class = "colFirst" > < code > static void< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#setCacheMethods(boolean)" > setCacheMethods< / a > < / strong > (boolean cacheMethods)< / code >
2012-10-17 07:58:24 +02:00
< div class = "block" > Set whether methods should be cached for greater performance or not,
2012-09-18 17:27:59 +02:00
default is < code > true< / code > .< / div >
< / td >
< / tr >
< tr class = "rowColor" >
< td class = "colFirst" > < code > static java.lang.Class< / code > < / td >
< td class = "colLast" > < code > < strong > < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#toNonPrimitiveClass(java.lang.Class)" > toNonPrimitiveClass< / a > < / strong > (java.lang.Class clazz)< / code >
< div class = "block" > Find a non primitive representation for given primitive class.< / div >
< / td >
< / tr >
< / table >
< ul class = "blockList" >
< li class = "blockList" > < a name = "methods_inherited_from_class_java.lang.Object" >
<!-- -->
< / a >
< h3 > Methods inherited from class java.lang.Object< / h3 >
< code > clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait< / code > < / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< / div >
< div class = "details" >
< ul class = "blockList" >
< li class = "blockList" >
<!-- ========= CONSTRUCTOR DETAIL ======== -->
< ul class = "blockList" >
< li class = "blockList" > < a name = "constructor_detail" >
<!-- -->
< / a >
< h3 > Constructor Detail< / h3 >
< a name = "MethodUtils()" >
<!-- -->
< / a >
< ul class = "blockListLast" >
< li class = "blockList" >
< h4 > MethodUtils< / h4 >
< pre > public MethodUtils()< / pre >
< / li >
< / ul >
< / li >
< / ul >
<!-- ============ METHOD DETAIL ========== -->
< ul class = "blockList" >
< li class = "blockList" > < a name = "method_detail" >
<!-- -->
< / a >
< h3 > Method Detail< / h3 >
< a name = "setCacheMethods(boolean)" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > setCacheMethods< / h4 >
< pre > public static void setCacheMethods(boolean cacheMethods)< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > Set whether methods should be cached for greater performance or not,
2012-09-18 17:27:59 +02:00
default is < code > true< / code > .< / div >
2012-10-17 07:58:24 +02:00
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > cacheMethods< / code > - < code > true< / code > if methods should be
2012-09-18 17:27:59 +02:00
cached for greater performance, otherwise < code > false< / code > < / dd > < dt > < span class = "strong" > Since:< / span > < / dt >
< dd > 1.8.0< / dd > < / dl >
< / li >
< / ul >
< a name = "clearCache()" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > clearCache< / h4 >
< pre > public static int clearCache()< / pre >
< div class = "block" > Clear the method cache.< / div >
< dl > < dt > < span class = "strong" > Returns:< / span > < / dt > < dd > the number of cached methods cleared< / dd > < dt > < span class = "strong" > Since:< / span > < / dt >
< dd > 1.8.0< / dd > < / dl >
< / li >
< / ul >
< a name = "invokeMethod(java.lang.Object, java.lang.String, java.lang.Object)" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > invokeMethod< / h4 >
< pre > public static java.lang.Object invokeMethod(java.lang.Object object,
java.lang.String methodName,
java.lang.Object arg)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Invoke a named method whose parameter type matches the object type.< / p >
< p > The behaviour of this method is less deterministic
than < code > invokeExactMethod()< / code > .
It loops through all methods with names that match
and then executes the first it finds with compatable parameters.< / p >
< p > This method supports calls to methods taking primitive parameters
via passing in wrapping classes. So, for example, a < code > Boolean< / code > class
would match a < code > boolean< / code > primitive.< / p >
< p > This is a convenient wrapper for
< a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeMethod(java.lang.Object, java.lang.String, java.lang.Object[])" > < code > invokeMethod(Object object,String methodName,Object [] args)< / code > < / a > .
2012-09-18 17:27:59 +02:00
< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > object< / code > - invoke method on this object< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > arg< / code > - use this argument< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The value returned by the invoked method< / dd >
< dt > < span class = "strong" > Throws:< / span > < / dt >
< dd > < code > java.lang.NoSuchMethodException< / code > - if there is no such accessible method< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.reflect.InvocationTargetException< / code > - wraps an exception thrown by the
2012-09-18 17:27:59 +02:00
method invoked< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.IllegalAccessException< / code > - if the requested method is not accessible
2012-09-18 17:27:59 +02:00
via reflection< / dd > < / dl >
< / li >
< / ul >
< a name = "invokeMethod(java.lang.Object, java.lang.String, java.lang.Object[])" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > invokeMethod< / h4 >
< pre > public static java.lang.Object invokeMethod(java.lang.Object object,
java.lang.String methodName,
java.lang.Object[] args)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Invoke a named method whose parameter type matches the object type.< / p >
< p > The behaviour of this method is less deterministic
than < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactMethod(java.lang.Object, java.lang.String, java.lang.Object[])" > < code > invokeExactMethod(Object object,String methodName,Object [] args)< / code > < / a > .
It loops through all methods with names that match
and then executes the first it finds with compatable parameters.< / p >
< p > This method supports calls to methods taking primitive parameters
via passing in wrapping classes. So, for example, a < code > Boolean< / code > class
would match a < code > boolean< / code > primitive.< / p >
< p > This is a convenient wrapper for
< a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeMethod(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Class[])" > < code > invokeMethod(Object object,String methodName,Object [] args,Class[] parameterTypes)< / code > < / a > .
2012-09-18 17:27:59 +02:00
< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > object< / code > - invoke method on this object< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > args< / code > - use these arguments - treat null as empty array< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The value returned by the invoked method< / dd >
< dt > < span class = "strong" > Throws:< / span > < / dt >
< dd > < code > java.lang.NoSuchMethodException< / code > - if there is no such accessible method< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.reflect.InvocationTargetException< / code > - wraps an exception thrown by the
2012-09-18 17:27:59 +02:00
method invoked< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.IllegalAccessException< / code > - if the requested method is not accessible
2012-09-18 17:27:59 +02:00
via reflection< / dd > < / dl >
< / li >
< / ul >
< a name = "invokeMethod(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Class[])" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > invokeMethod< / h4 >
< pre > public static java.lang.Object invokeMethod(java.lang.Object object,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.Class[] parameterTypes)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Invoke a named method whose parameter type matches the object type.< / p >
< p > The behaviour of this method is less deterministic
than < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactMethod(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Class[])" > < code > invokeExactMethod(Object object,String methodName,Object [] args,Class[] parameterTypes)< / code > < / a > .
It loops through all methods with names that match
and then executes the first it finds with compatable parameters.< / p >
< p > This method supports calls to methods taking primitive parameters
via passing in wrapping classes. So, for example, a < code > Boolean< / code > class
2012-09-18 17:27:59 +02:00
would match a < code > boolean< / code > primitive.< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > object< / code > - invoke method on this object< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > args< / code > - use these arguments - treat null as empty array< / dd > < dd > < code > parameterTypes< / code > - match these parameters - treat null as empty array< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The value returned by the invoked method< / dd >
< dt > < span class = "strong" > Throws:< / span > < / dt >
< dd > < code > java.lang.NoSuchMethodException< / code > - if there is no such accessible method< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.reflect.InvocationTargetException< / code > - wraps an exception thrown by the
2012-09-18 17:27:59 +02:00
method invoked< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.IllegalAccessException< / code > - if the requested method is not accessible
2012-09-18 17:27:59 +02:00
via reflection< / dd > < / dl >
< / li >
< / ul >
< a name = "invokeExactMethod(java.lang.Object, java.lang.String, java.lang.Object)" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > invokeExactMethod< / h4 >
< pre > public static java.lang.Object invokeExactMethod(java.lang.Object object,
java.lang.String methodName,
java.lang.Object arg)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Invoke a method whose parameter type matches exactly the object
type.< / p >
< p > This is a convenient wrapper for
< a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactMethod(java.lang.Object, java.lang.String, java.lang.Object[])" > < code > invokeExactMethod(Object object,String methodName,Object [] args)< / code > < / a > .
2012-09-18 17:27:59 +02:00
< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > object< / code > - invoke method on this object< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > arg< / code > - use this argument< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The value returned by the invoked method< / dd >
< dt > < span class = "strong" > Throws:< / span > < / dt >
< dd > < code > java.lang.NoSuchMethodException< / code > - if there is no such accessible method< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.reflect.InvocationTargetException< / code > - wraps an exception thrown by the
2012-09-18 17:27:59 +02:00
method invoked< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.IllegalAccessException< / code > - if the requested method is not accessible
2012-09-18 17:27:59 +02:00
via reflection< / dd > < / dl >
< / li >
< / ul >
< a name = "invokeExactMethod(java.lang.Object, java.lang.String, java.lang.Object[])" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > invokeExactMethod< / h4 >
< pre > public static java.lang.Object invokeExactMethod(java.lang.Object object,
java.lang.String methodName,
java.lang.Object[] args)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Invoke a method whose parameter types match exactly the object
types.< / p >
< p > This uses reflection to invoke the method obtained from a call to
2012-09-18 17:27:59 +02:00
< code > getAccessibleMethod()< / code > .< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > object< / code > - invoke method on this object< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > args< / code > - use these arguments - treat null as empty array< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The value returned by the invoked method< / dd >
< dt > < span class = "strong" > Throws:< / span > < / dt >
< dd > < code > java.lang.NoSuchMethodException< / code > - if there is no such accessible method< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.reflect.InvocationTargetException< / code > - wraps an exception thrown by the
2012-09-18 17:27:59 +02:00
method invoked< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.IllegalAccessException< / code > - if the requested method is not accessible
2012-09-18 17:27:59 +02:00
via reflection< / dd > < / dl >
< / li >
< / ul >
< a name = "invokeExactMethod(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Class[])" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > invokeExactMethod< / h4 >
< pre > public static java.lang.Object invokeExactMethod(java.lang.Object object,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.Class[] parameterTypes)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Invoke a method whose parameter types match exactly the parameter
types given.< / p >
< p > This uses reflection to invoke the method obtained from a call to
2012-09-18 17:27:59 +02:00
< code > getAccessibleMethod()< / code > .< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > object< / code > - invoke method on this object< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > args< / code > - use these arguments - treat null as empty array< / dd > < dd > < code > parameterTypes< / code > - match these parameters - treat null as empty array< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The value returned by the invoked method< / dd >
< dt > < span class = "strong" > Throws:< / span > < / dt >
< dd > < code > java.lang.NoSuchMethodException< / code > - if there is no such accessible method< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.reflect.InvocationTargetException< / code > - wraps an exception thrown by the
2012-09-18 17:27:59 +02:00
method invoked< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.IllegalAccessException< / code > - if the requested method is not accessible
2012-09-18 17:27:59 +02:00
via reflection< / dd > < / dl >
< / li >
< / ul >
< a name = "invokeExactStaticMethod(java.lang.Class, java.lang.String, java.lang.Object[], java.lang.Class[])" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > invokeExactStaticMethod< / h4 >
< pre > public static java.lang.Object invokeExactStaticMethod(java.lang.Class objectClass,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.Class[] parameterTypes)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Invoke a static method whose parameter types match exactly the parameter
types given.< / p >
< p > This uses reflection to invoke the method obtained from a call to
2012-09-18 17:27:59 +02:00
< a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#getAccessibleMethod(java.lang.Class, java.lang.String, java.lang.Class[])" > < code > getAccessibleMethod(Class, String, Class[])< / code > < / a > .< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > objectClass< / code > - invoke static method on this class< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > args< / code > - use these arguments - treat null as empty array< / dd > < dd > < code > parameterTypes< / code > - match these parameters - treat null as empty array< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The value returned by the invoked method< / dd >
< dt > < span class = "strong" > Throws:< / span > < / dt >
< dd > < code > java.lang.NoSuchMethodException< / code > - if there is no such accessible method< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.reflect.InvocationTargetException< / code > - wraps an exception thrown by the
2012-09-18 17:27:59 +02:00
method invoked< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.IllegalAccessException< / code > - if the requested method is not accessible
2012-09-18 17:27:59 +02:00
via reflection< / dd > < dt > < span class = "strong" > Since:< / span > < / dt >
< dd > 1.8.0< / dd > < / dl >
< / li >
< / ul >
< a name = "invokeStaticMethod(java.lang.Class, java.lang.String, java.lang.Object)" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > invokeStaticMethod< / h4 >
< pre > public static java.lang.Object invokeStaticMethod(java.lang.Class objectClass,
java.lang.String methodName,
java.lang.Object arg)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Invoke a named static method whose parameter type matches the object type.< / p >
< p > The behaviour of this method is less deterministic
than < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactMethod(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Class[])" > < code > invokeExactMethod(Object, String, Object[], Class[])< / code > < / a > .
It loops through all methods with names that match
and then executes the first it finds with compatable parameters.< / p >
< p > This method supports calls to methods taking primitive parameters
via passing in wrapping classes. So, for example, a < code > Boolean< / code > class
would match a < code > boolean< / code > primitive.< / p >
< p > This is a convenient wrapper for
< a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeStaticMethod(java.lang.Class, java.lang.String, java.lang.Object[])" > < code > invokeStaticMethod(Class objectClass,String methodName,Object [] args)< / code > < / a > .
2012-09-18 17:27:59 +02:00
< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > objectClass< / code > - invoke static method on this class< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > arg< / code > - use this argument< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The value returned by the invoked method< / dd >
< dt > < span class = "strong" > Throws:< / span > < / dt >
< dd > < code > java.lang.NoSuchMethodException< / code > - if there is no such accessible method< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.reflect.InvocationTargetException< / code > - wraps an exception thrown by the
2012-09-18 17:27:59 +02:00
method invoked< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.IllegalAccessException< / code > - if the requested method is not accessible
2012-09-18 17:27:59 +02:00
via reflection< / dd > < dt > < span class = "strong" > Since:< / span > < / dt >
< dd > 1.8.0< / dd > < / dl >
< / li >
< / ul >
< a name = "invokeStaticMethod(java.lang.Class, java.lang.String, java.lang.Object[])" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > invokeStaticMethod< / h4 >
< pre > public static java.lang.Object invokeStaticMethod(java.lang.Class objectClass,
java.lang.String methodName,
java.lang.Object[] args)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Invoke a named static method whose parameter type matches the object type.< / p >
< p > The behaviour of this method is less deterministic
than < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactMethod(java.lang.Object, java.lang.String, java.lang.Object[])" > < code > invokeExactMethod(Object object,String methodName,Object [] args)< / code > < / a > .
It loops through all methods with names that match
and then executes the first it finds with compatable parameters.< / p >
< p > This method supports calls to methods taking primitive parameters
via passing in wrapping classes. So, for example, a < code > Boolean< / code > class
would match a < code > boolean< / code > primitive.< / p >
< p > This is a convenient wrapper for
< a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeStaticMethod(java.lang.Class, java.lang.String, java.lang.Object[], java.lang.Class[])" > < code > invokeStaticMethod(Class objectClass,String methodName,Object [] args,Class[] parameterTypes)< / code > < / a > .
2012-09-18 17:27:59 +02:00
< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > objectClass< / code > - invoke static method on this class< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > args< / code > - use these arguments - treat null as empty array< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The value returned by the invoked method< / dd >
< dt > < span class = "strong" > Throws:< / span > < / dt >
< dd > < code > java.lang.NoSuchMethodException< / code > - if there is no such accessible method< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.reflect.InvocationTargetException< / code > - wraps an exception thrown by the
2012-09-18 17:27:59 +02:00
method invoked< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.IllegalAccessException< / code > - if the requested method is not accessible
2012-09-18 17:27:59 +02:00
via reflection< / dd > < dt > < span class = "strong" > Since:< / span > < / dt >
< dd > 1.8.0< / dd > < / dl >
< / li >
< / ul >
< a name = "invokeStaticMethod(java.lang.Class, java.lang.String, java.lang.Object[], java.lang.Class[])" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > invokeStaticMethod< / h4 >
< pre > public static java.lang.Object invokeStaticMethod(java.lang.Class objectClass,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.Class[] parameterTypes)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Invoke a named static method whose parameter type matches the object type.< / p >
< p > The behaviour of this method is less deterministic
than < a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactStaticMethod(java.lang.Class, java.lang.String, java.lang.Object[], java.lang.Class[])" > < code > invokeExactStaticMethod(Class objectClass,String methodName,Object [] args,Class[] parameterTypes)< / code > < / a > .
It loops through all methods with names that match
and then executes the first it finds with compatable parameters.< / p >
< p > This method supports calls to methods taking primitive parameters
via passing in wrapping classes. So, for example, a < code > Boolean< / code > class
2012-09-18 17:27:59 +02:00
would match a < code > boolean< / code > primitive.< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > objectClass< / code > - invoke static method on this class< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > args< / code > - use these arguments - treat null as empty array< / dd > < dd > < code > parameterTypes< / code > - match these parameters - treat null as empty array< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The value returned by the invoked method< / dd >
< dt > < span class = "strong" > Throws:< / span > < / dt >
< dd > < code > java.lang.NoSuchMethodException< / code > - if there is no such accessible method< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.reflect.InvocationTargetException< / code > - wraps an exception thrown by the
2012-09-18 17:27:59 +02:00
method invoked< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.IllegalAccessException< / code > - if the requested method is not accessible
2012-09-18 17:27:59 +02:00
via reflection< / dd > < dt > < span class = "strong" > Since:< / span > < / dt >
< dd > 1.8.0< / dd > < / dl >
< / li >
< / ul >
< a name = "invokeExactStaticMethod(java.lang.Class, java.lang.String, java.lang.Object)" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > invokeExactStaticMethod< / h4 >
< pre > public static java.lang.Object invokeExactStaticMethod(java.lang.Class objectClass,
java.lang.String methodName,
java.lang.Object arg)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Invoke a static method whose parameter type matches exactly the object
type.< / p >
< p > This is a convenient wrapper for
< a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeExactStaticMethod(java.lang.Class, java.lang.String, java.lang.Object[])" > < code > invokeExactStaticMethod(Class objectClass,String methodName,Object [] args)< / code > < / a > .
2012-09-18 17:27:59 +02:00
< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > objectClass< / code > - invoke static method on this class< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > arg< / code > - use this argument< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The value returned by the invoked method< / dd >
< dt > < span class = "strong" > Throws:< / span > < / dt >
< dd > < code > java.lang.NoSuchMethodException< / code > - if there is no such accessible method< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.reflect.InvocationTargetException< / code > - wraps an exception thrown by the
2012-09-18 17:27:59 +02:00
method invoked< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.IllegalAccessException< / code > - if the requested method is not accessible
2012-09-18 17:27:59 +02:00
via reflection< / dd > < dt > < span class = "strong" > Since:< / span > < / dt >
< dd > 1.8.0< / dd > < / dl >
< / li >
< / ul >
< a name = "invokeExactStaticMethod(java.lang.Class, java.lang.String, java.lang.Object[])" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > invokeExactStaticMethod< / h4 >
< pre > public static java.lang.Object invokeExactStaticMethod(java.lang.Class objectClass,
java.lang.String methodName,
java.lang.Object[] args)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Invoke a static method whose parameter types match exactly the object
types.< / p >
< p > This uses reflection to invoke the method obtained from a call to
2012-09-18 17:27:59 +02:00
< a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#getAccessibleMethod(java.lang.Class, java.lang.String, java.lang.Class[])" > < code > getAccessibleMethod(Class, String, Class[])< / code > < / a > .< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > objectClass< / code > - invoke static method on this class< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > args< / code > - use these arguments - treat null as empty array< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The value returned by the invoked method< / dd >
< dt > < span class = "strong" > Throws:< / span > < / dt >
< dd > < code > java.lang.NoSuchMethodException< / code > - if there is no such accessible method< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.reflect.InvocationTargetException< / code > - wraps an exception thrown by the
2012-09-18 17:27:59 +02:00
method invoked< / dd >
2012-10-17 07:58:24 +02:00
< dd > < code > java.lang.IllegalAccessException< / code > - if the requested method is not accessible
2012-09-18 17:27:59 +02:00
via reflection< / dd > < dt > < span class = "strong" > Since:< / span > < / dt >
< dd > 1.8.0< / dd > < / dl >
< / li >
< / ul >
< a name = "getAccessibleMethod(java.lang.Class, java.lang.String, java.lang.Class[])" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > getAccessibleMethod< / h4 >
< pre > public static java.lang.reflect.Method getAccessibleMethod(java.lang.Class clazz,
java.lang.String methodName,
java.lang.Class[] parameterTypes)< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Return an accessible method (that is, one that can be invoked via
reflection) with given name and parameters. If no such method
can be found, return < code > null< / code > .
This is just a convenient wrapper for
2012-09-18 17:27:59 +02:00
< a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#getAccessibleMethod(java.lang.reflect.Method)" > < code > getAccessibleMethod(Method method)< / code > < / a > .< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > clazz< / code > - get method from this class< / dd > < dd > < code > methodName< / code > - get method with this name< / dd > < dd > < code > parameterTypes< / code > - with these parameters types< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The accessible method< / dd > < / dl >
< / li >
< / ul >
< a name = "getAccessibleMethod(java.lang.reflect.Method)" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > getAccessibleMethod< / h4 >
< pre > public static java.lang.reflect.Method getAccessibleMethod(java.lang.reflect.Method method)< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Return an accessible method (that is, one that can be invoked via
reflection) that implements the specified Method. If no such method
2012-09-18 17:27:59 +02:00
can be found, return < code > null< / code > .< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > method< / code > - The method that we wish to call< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The accessible method< / dd > < / dl >
< / li >
< / ul >
< a name = "getAccessibleMethod(java.lang.Class, java.lang.reflect.Method)" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > getAccessibleMethod< / h4 >
< pre > public static java.lang.reflect.Method getAccessibleMethod(java.lang.Class clazz,
java.lang.reflect.Method method)< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Return an accessible method (that is, one that can be invoked via
reflection) that implements the specified Method. If no such method
2012-09-18 17:27:59 +02:00
can be found, return < code > null< / code > .< / p > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > clazz< / code > - The class of the object< / dd > < dd > < code > method< / code > - The method that we wish to call< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The accessible method< / dd > < dt > < span class = "strong" > Since:< / span > < / dt >
< dd > 1.8.0< / dd > < / dl >
< / li >
< / ul >
< a name = "getMatchingAccessibleMethod(java.lang.Class, java.lang.String, java.lang.Class[])" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > getMatchingAccessibleMethod< / h4 >
< pre > public static java.lang.reflect.Method getMatchingAccessibleMethod(java.lang.Class clazz,
java.lang.String methodName,
java.lang.Class[] parameterTypes)< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Find an accessible method that matches the given name and has compatible parameters.
Compatible parameters mean that every method parameter is assignable from
the given parameters.
In other words, it finds a method with the given name
that will take the parameters given.< p >
< p > This method is slightly undeterminstic since it loops
through methods names and return the first matching method.< / p >
< p > This method is used by
< a href = "../../../../com/comphenix/protocol/reflect/MethodUtils.html#invokeMethod(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Class[])" > < code > invokeMethod(Object object,String methodName,Object [] args,Class[] parameterTypes)< / code > < / a > .
< p > This method can match primitive parameter by passing in wrapper classes.
For example, a < code > Boolean< / code > will match a primitive < code > boolean< / code >
2012-09-18 17:27:59 +02:00
parameter.< / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > clazz< / code > - find method in this class< / dd > < dd > < code > methodName< / code > - find method with this name< / dd > < dd > < code > parameterTypes< / code > - find method with compatible parameters< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > The accessible method< / dd > < / dl >
< / li >
< / ul >
< a name = "isAssignmentCompatible(java.lang.Class, java.lang.Class)" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > isAssignmentCompatible< / h4 >
< pre > public static final boolean isAssignmentCompatible(java.lang.Class parameterType,
java.lang.Class parameterization)< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > < p > Determine whether a type can be used as a parameter in a method invocation.
This method handles primitive conversions correctly.< / p >
< p > In order words, it will match a < code > Boolean< / code > to a < code > boolean< / code > ,
a < code > Long< / code > to a < code > long< / code > ,
a < code > Float< / code > to a < code > float< / code > ,
a < code > Integer< / code > to a < code > int< / code > ,
and a < code > Double< / code > to a < code > double< / code > .
Now logic widening matches are allowed.
2012-09-18 17:27:59 +02:00
For example, a < code > Long< / code > will not match a < code > int< / code > .< / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > parameterType< / code > - the type of parameter accepted by the method< / dd > < dd > < code > parameterization< / code > - the type of parameter being tested< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > true if the assignement is compatible.< / dd > < / dl >
< / li >
< / ul >
< a name = "getPrimitiveWrapper(java.lang.Class)" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > getPrimitiveWrapper< / h4 >
< pre > public static java.lang.Class getPrimitiveWrapper(java.lang.Class primitiveType)< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > Gets the wrapper object class for the given primitive type class.
2012-09-18 17:27:59 +02:00
For example, passing < code > boolean.class< / code > returns < code > Boolean.class< / code > < / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > primitiveType< / code > - the primitive type class for which a match is to be found< / dd >
2012-10-17 07:58:24 +02:00
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > the wrapper type associated with the given primitive
2012-09-18 17:27:59 +02:00
or null if no match is found< / dd > < / dl >
< / li >
< / ul >
< a name = "getPrimitiveType(java.lang.Class)" >
<!-- -->
< / a >
< ul class = "blockList" >
< li class = "blockList" >
< h4 > getPrimitiveType< / h4 >
< pre > public static java.lang.Class getPrimitiveType(java.lang.Class wrapperType)< / pre >
2012-10-17 07:58:24 +02:00
< div class = "block" > Gets the class for the primitive type corresponding to the primitive wrapper class given.
2012-09-18 17:27:59 +02:00
For example, an instance of < code > Boolean.class< / code > returns a < code > boolean.class< / code > .< / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > wrapperType< / code > - the< / dd >
2012-10-17 07:58:24 +02:00
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > the primitive type class corresponding to the given wrapper class,
2012-09-18 17:27:59 +02:00
null if no match is found< / dd > < / dl >
< / li >
< / ul >
< a name = "toNonPrimitiveClass(java.lang.Class)" >
<!-- -->
< / a >
< ul class = "blockListLast" >
< li class = "blockList" >
< h4 > toNonPrimitiveClass< / h4 >
< pre > public static java.lang.Class toNonPrimitiveClass(java.lang.Class clazz)< / pre >
< div class = "block" > Find a non primitive representation for given primitive class.< / div >
< dl > < dt > < span class = "strong" > Parameters:< / span > < / dt > < dd > < code > clazz< / code > - the class to find a representation for, not null< / dd >
< dt > < span class = "strong" > Returns:< / span > < / dt > < dd > the original class if it not a primitive. Otherwise the wrapper class. Not null< / dd > < / dl >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< / div >
< / div >
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
< div class = "bottomNav" > < a name = "navbar_bottom" >
<!-- -->
< / a > < a href = "#skip-navbar_bottom" title = "Skip navigation links" > < / a > < a name = "navbar_bottom_firstrow" >
<!-- -->
< / a >
< ul class = "navList" title = "Navigation" >
< li > < a href = "../../../../overview-summary.html" > Overview< / a > < / li >
< li > < a href = "package-summary.html" > Package< / a > < / li >
< li class = "navBarCell1Rev" > Class< / li >
< li > < a href = "class-use/MethodUtils.html" > Use< / a > < / li >
< li > < a href = "package-tree.html" > Tree< / a > < / li >
< li > < a href = "../../../../deprecated-list.html" > Deprecated< / a > < / li >
< li > < a href = "../../../../index-files/index-1.html" > Index< / a > < / li >
< li > < a href = "../../../../help-doc.html" > Help< / a > < / li >
< / ul >
< / div >
< div class = "subNav" >
< ul class = "navList" >
< li > < a href = "../../../../com/comphenix/protocol/reflect/IntEnum.html" title = "class in com.comphenix.protocol.reflect" > < span class = "strong" > Prev Class< / span > < / a > < / li >
2012-10-05 04:45:17 +02:00
< li > < a href = "../../../../com/comphenix/protocol/reflect/ObjectCloner.html" title = "class in com.comphenix.protocol.reflect" > < span class = "strong" > Next Class< / span > < / a > < / li >
2012-09-18 17:27:59 +02:00
< / ul >
< ul class = "navList" >
< li > < a href = "../../../../index.html?com/comphenix/protocol/reflect/MethodUtils.html" target = "_top" > Frames< / a > < / li >
< li > < a href = "MethodUtils.html" target = "_top" > No Frames< / a > < / li >
< / ul >
< ul class = "navList" id = "allclasses_navbar_bottom" >
< li > < a href = "../../../../allclasses-noframe.html" > All Classes< / a > < / li >
< / ul >
< div >
< script type = "text/javascript" > < ! - -
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
< / script >
< / div >
< div >
< ul class = "subNavList" >
< li > Summary: < / li >
< li > Nested | < / li >
< li > Field | < / li >
< li > < a href = "#constructor_summary" > Constr< / a > | < / li >
< li > < a href = "#method_summary" > Method< / a > < / li >
< / ul >
< ul class = "subNavList" >
< li > Detail: < / li >
< li > Field | < / li >
< li > < a href = "#constructor_detail" > Constr< / a > | < / li >
< li > < a href = "#method_detail" > Method< / a > < / li >
< / ul >
< / div >
< a name = "skip-navbar_bottom" >
<!-- -->
< / a > < / div >
<!-- ======== END OF BOTTOM NAVBAR ======= -->
< / body >
< / html >