APIdia Launch Partner
Top Description Constructors Methods
com.sun.beans.finder

public final Class ClassFinder

extends Object
Class Inheritance

This is utility class that provides static methods to find a class with the specified name using the specified class loader.
Author
Sergey A. Malenkov
Since
1.7

Constructor Summary

AccessConstructor and Description
private
ClassFinder()

Disable instantiation.

Method Summary

Modifier and TypeMethod and Description
public static Class<?>

Returns:

class object representing the desired class
findClass
(String
fully qualified name of the desired class
name
)

Returns the Class object associated with the class or interface with the given string name, using the default class loader.

public static Class<?>

Returns:

class object representing the desired class
findClass
(String
fully qualified name of the desired class
name
,
ClassLoader
class loader from which the class must be loaded
loader
)

Returns the Class object associated with the class or interface with the given string name, using the given class loader.

public static Class<?>

Returns:

class object representing the desired class
resolveClass
(String
fully qualified name of the desired class
name
)

Returns the Class object associated with the class or interface with the given string name, using the default class loader.

public static Class<?>

Returns:

class object representing the desired class
resolveClass
(String
fully qualified name of the desired class
name
,
ClassLoader
class loader from which the class must be loaded
loader
)

Returns the Class object associated with the class or interface with the given string name, using the given class loader.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ClassFinderback to summary
private ClassFinder()

Disable instantiation.

Method Detail

findClassback to summary
public static Class<?> findClass(String name) throws ClassNotFoundException

Returns the Class object associated with the class or interface with the given string name, using the default class loader.

The name can denote an array class (see Class#getName for details).

Parameters
name:String

fully qualified name of the desired class

Returns:Class<?>

class object representing the desired class

Exceptions
ClassNotFoundException:
if the class cannot be located by the specified class loader
See Also
Class#forName(String), Class#forName(String, boolean, ClassLoader), ClassLoader#getSystemClassLoader(), Thread#getContextClassLoader()
findClassback to summary
public static Class<?> findClass(String name, ClassLoader loader) throws ClassNotFoundException

Returns the Class object associated with the class or interface with the given string name, using the given class loader.

The name can denote an array class (see Class#getName for details).

If the parameter loader is null, the class is loaded through the default class loader.

Parameters
name:String

fully qualified name of the desired class

loader:ClassLoader

class loader from which the class must be loaded

Returns:Class<?>

class object representing the desired class

Exceptions
ClassNotFoundException:
if the class cannot be located by the specified class loader
See Also
findClass(String, ClassLoader), Class#forName(String, boolean, ClassLoader)
resolveClassback to summary
public static Class<?> resolveClass(String name) throws ClassNotFoundException

Returns the Class object associated with the class or interface with the given string name, using the default class loader.

The name can denote an array class (see Class#getName for details).

This method can be used to obtain any of the Class objects representing void or primitive Java types: char, byte, short, int, long, float, double and boolean.

Parameters
name:String

fully qualified name of the desired class

Returns:Class<?>

class object representing the desired class

Exceptions
ClassNotFoundException:
if the class cannot be located by the specified class loader
See Also
resolveClass(String, ClassLoader)
resolveClassback to summary
public static Class<?> resolveClass(String name, ClassLoader loader) throws ClassNotFoundException

Returns the Class object associated with the class or interface with the given string name, using the given class loader.

The name can denote an array class (see Class#getName for details).

If the parameter loader is null, the class is loaded through the default class loader.

This method can be used to obtain any of the Class objects representing void or primitive Java types: char, byte, short, int, long, float, double and boolean.

Parameters
name:String

fully qualified name of the desired class

loader:ClassLoader

class loader from which the class must be loaded

Returns:Class<?>

class object representing the desired class

Exceptions
ClassNotFoundException:
if the class cannot be located by the specified class loader
See Also
findClass(String, ClassLoader), PrimitiveTypeMap#getType(String)