Package java.lang
Class Class<T>
- java.lang.Object
-
- java.lang.Class<T>
-
- All Implemented Interfaces:
Serializable
,Modified
public final class Class<T> extends Object implements Serializable, Modified
The in-memory representation of a Java class. This is maily a stub, as we currently do not support reflection.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Class<?>
forName(String className)
Returns aClass
object which represents the class with the given name.String
getName()
Returns the name of the class represented by thisClass
.String
toString()
Returns a string containing a concise, human-readable description of this object.
-
-
-
Method Detail
-
forName
public static Class<?> forName(String className) throws ClassNotFoundException
Returns aClass
object which represents the class with the given name. The name should be the name of a non-primitive class, as described in theclass definition
. Primitive types can not be found using this method; useint.class
orInteger.TYPE
instead.If the class has not yet been loaded, it is loaded and initialized first. This is done through either the class loader of the calling class or one of its parent class loaders. It is possible that a static initializer is run as a result of this call.
- Parameters:
className
- Name of the class.- Returns:
- Class
- Throws:
ClassNotFoundException
- if the requested class can not be found.LinkageError
- if an error occurs during linkagejava.lang.ExceptionInInitializerError
- if an exception occurs during static initialization of a class.
-
getName
public String getName()
Returns the name of the class represented by thisClass
. For a description of the format which is used, see the class definition ofClass
.- Returns:
- Name of the class.
-
-