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
-
Class()
-
-
getGenericClass()
- return the generic class if the class is an instantiation of
template class.
-
getTemplateParametersType()
- Returns an array containing Class objects representing the type
of all template parameters of this Class object.
-
instantiate(Class[])
- Instantiate a generic class with specific template parameters.
-
isGeneric()
- Determines if the specified Class object is a generic class.
Class
public Class()
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.
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.
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.
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:
- If the class represented by Class object is not generic,
the instantiation throws an InstantiationException.
- 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.
- For each actual parameter in the supplied args array:
- If the actual parameter is null, the template parameter stay
as a template parameter of the creating class.
- If the actual parameter is non-null but it doesn't match with
the type of the template parameter, the instantiation throws
an IllegalArgumentException.
- 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.
- 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