All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.lang.Class

java.lang.Object
   |
   +----java.lang.Class

public abstract class Class
extends Object

Constructor Index

 o Class()

Method Index

 o getGenericClass()
return the generic class if the class is an instantiation of template class.
 o getTemplateParametersType()
Returns an array containing Class objects representing the type of all template parameters of this Class object.
 o instantiate(Class[])
Instantiate a generic class with specific template parameters.
 o isGeneric()
Determines if the specified Class object is a generic class.

Constructors

 o Class
 public Class()

Methods

 o isGeneric
 public native boolean isGeneric()
Determines if the specified Class object is a generic class.

Returns:
true if the class is a generic class false otherwise.
 o getGenericClass
 public native Class getGenericClass()
return the generic class if the class is an instantiation of template class.

Returns:
null if the class is not a template instantiation class or the generic class used to instantiate the current class.
 o getTemplateParametersType
 public native Class[] getTemplateParametersType()
Returns an array containing Class objects representing the type of all template parameters of this Class object.
Returns an array of length 0 if the class has no template parameter, if the class is generic.

 o instantiate
 public native Class instantiate(Class args[]) throws InstantiationException, IllegalArgumentException
Instantiate a generic class with specific template parameters.
Template intantiation proceeds with the following steps:
  1. If the class represented by Class object is not generic, the instantiation throws an InstantiationException.
  2. If the number of actual parameters supplied via args is different from the number of template parameters required by the generic class, the instantiation throws an IllegalArgumentException.
  3. For each actual parameter in the supplied args array:
    1. If the actual parameter is null, the template parameter stay as a template parameter of the creating class.
    2. If the actual parameter is non-null but it doesn't match with the type of the template parameter, the instantiation throws an IllegalArgumentException.
    3. If the actual parameter match with the type of the template parameter and representing a generic class, all the template parameter of the generic class are add as new template parameter of the creating class.
    4. If the actual parameter match with the type of the template parameter and representing a non-generic class, the template parameter is replace by the actual parameter.

A class is not generic if it has no template parameter, if one actual parameter is null or is a generic class, the class created by instantiation is generic.

Throws: InstantiationException
if the class is not generic.
Throws: IllegalArgumentException
if the number of actual and template parameters differ, or if a actual parameter doesn't match with its corresponding template parameter.
See Also:
isGeneric, getTemplateParametersType

All Packages  Class Hierarchy  This Package  Previous  Next  Index