public final class

MethodUtil

extends SecureClassLoader
java.lang.Object
   ↳ java.lang.ClassLoader
     ↳ java.security.SecureClassLoader
       ↳ sun.reflect.misc.MethodUtil

Summary

Public Methods
static Method getMethod(Class cls, String name, Class[] args)
static Method[] getMethods(Class cls)
static Method[] getPublicMethods(Class cls)
static Object invoke(Method m, Object obj, Object[] params)
Protected Methods
Class findClass(String name)
Finds the class with the specified binary name.
PermissionCollection getPermissions(CodeSource codesource)
Returns the permissions for the given CodeSource object.
synchronized Class loadClass(String name, boolean resolve)
Loads the class with the specified binary name.
[Expand]
Inherited Methods
From class java.security.SecureClassLoader
From class java.lang.ClassLoader
From class java.lang.Object

Public Methods

public static Method getMethod (Class cls, String name, Class[] args)

public static Method[] getMethods (Class cls)

public static Method[] getPublicMethods (Class cls)

public static Object invoke (Method m, Object obj, Object[] params)

Protected Methods

protected Class findClass (String name)

Finds the class with the specified binary name. This method should be overridden by class loader implementations that follow the delegation model for loading classes, and will be invoked by the loadClass method after checking the parent class loader for the requested class. The default implementation throws a ClassNotFoundException.

Parameters
name The binary name of the class
Returns
  • The resulting Class object

protected PermissionCollection getPermissions (CodeSource codesource)

Returns the permissions for the given CodeSource object.

This method is invoked by the defineClass method which takes a CodeSource as an argument when it is constructing the ProtectionDomain for the class being defined.

Parameters
codesource the codesource.
Returns
  • the permissions granted to the codesource.

protected synchronized Class loadClass (String name, boolean resolve)

Loads the class with the specified binary name. The default implementation of this method searches for classes in the following order:

  1. Invoke findLoadedClass(String) to check if the class has already been loaded.

  2. Invoke the loadClass method on the parent class loader. If the parent is null the class loader built-in to the virtual machine is used, instead.

  3. Invoke the findClass(String) method to find the class.

If the class was found using the above steps, and the resolve flag is true, this method will then invoke the resolveClass(Class) method on the resulting Class object.

Subclasses of ClassLoader are encouraged to override findClass(String), rather than this method.

Parameters
name The binary name of the class
resolve If true then resolve the class
Returns
  • The resulting Class object