| java.lang.Object com.sun.codemodel.JType com.sun.codemodel.JClass
All known Subclasses: com.sun.codemodel.JTypeWildcard, com.sun.codemodel.JArrayClass, com.sun.codemodel.JTypeVar, com.sun.codemodel.JDefinedClass, com.sun.codemodel.JNullType, com.sun.codemodel.JNarrowedClass, com.sun.codemodel.JDirectClass,
JClass | abstract public class JClass extends JType (Code) | | Represents a Java reference type, such as a class, an interface,
an enum, an array type, a parameterized type.
To be exact, this object represents an "use" of a reference type,
not necessarily a declaration of it, which is modeled as
JDefinedClass .
|
Field Summary | |
final protected static JTypeVar[] | EMPTY_ARRAY Sometimes useful reusable empty array. |
EMPTY_ARRAY | final protected static JTypeVar[] EMPTY_ARRAY(Code) | | Sometimes useful reusable empty array.
|
_extends | abstract public JClass _extends()(Code) | | Gets the super class of this class.
Returns the JClass representing the superclass of theentity (class or interface) represented by this JClass.Even if no super class is given explicitly or this JClassis not a class, this method still returnsJClass for Object.If this JClass represents Object, return null. |
_implements | abstract public Iterator<JClass> _implements()(Code) | | Iterates all super interfaces directly implemented by
this class/interface.
A non-null valid iterator that iterates allJClass objects that represents those interfacesimplemented by this object. |
_package | abstract public JPackage _package()(Code) | | Gets the package to which this class belongs.
TODO: shall we move move this down?
|
getBaseClass | final public JClass getBaseClass(JClass baseType)(Code) | | Gets the parameterization of the given base type.
For example, given the following
interface Foo extends List> {}
interface Bar extends Foo {}
This method works like this:
getBaseClass( Bar, List ) = List
getBaseClass( Bar, Foo ) = Foo
getBaseClass( Foo extends Number>, Collection ) = Collection>
getBaseClass( ArrayList extends BigInteger>, List ) = List extends BigInteger>
Parameters: baseType - The class whose parameterization we are interested in.The use of baseType in this type.or null if the type is not assignable to the base type. |
getPrimitiveType | public JPrimitiveType getPrimitiveType()(Code) | | If this class represents one of the wrapper classes
defined in the java.lang package, return the corresponding
primitive type. Otherwise null.
|
getTypeParameters | public List<JClass> getTypeParameters()(Code) | | If this class is parameterized, return the type parameter of the given index.
|
isAbstract | abstract public boolean isAbstract()(Code) | | Checks if this class is an abstract class.
|
isAssignableFrom | final public boolean isAssignableFrom(JClass derived)(Code) | | Checks the relationship between two classes.
This method works in the same way as
Class.isAssignableFrom(Class) works. For example, baseClass.isAssignableFrom(derivedClass)==true.
|
isInterface | abstract public boolean isInterface()(Code) | | Checks if this object represents an interface.
|
isParameterized | final public boolean isParameterized()(Code) | | Returns true if this class is a parameterized class.
|
name | abstract public String name()(Code) | | Gets the name of this class.
name of this class, without any qualification.For example, this method returns "String" forjava.lang.String . |
narrow | public JClass narrow(Class clazz)(Code) | | "Narrows" a generic class to a concrete class by specifying
a type argument.
.narrow(X) builds Set<X> from Set .
|
narrow | public JClass narrow(JClass clazz)(Code) | | "Narrows" a generic class to a concrete class by specifying
a type argument.
.narrow(X) builds Set<X> from Set .
|
outer | public JClass outer()(Code) | | Returns the class in which this class is nested, or null if
this is a top-level class.
|
owner | final public JCodeModel owner()(Code) | | Gets the JCodeModel object to which this object belongs.
|
printLink | void printLink(JFormatter f)(Code) | | Prints the class name in javadoc @link format.
|
substituteParams | abstract protected JClass substituteParams(JTypeVar[] variables, List<JClass> bindings)(Code) | | Substitutes the type variables with their actual arguments.
For example, when this class is Map<String,Map<V>>,
(where V then doing
substituteParams( V, Integer ) returns a
JClass for Map<String,Map<Integer>> .
This method needs to work recursively.
|
typeParams | public JTypeVar[] typeParams()(Code) | | Iterates all the type parameters of this class/interface.
For example, if this
JClass represents
Set<T> , this method returns an array
that contains single
JTypeVar for 'T'.
|
wildcard | final public JClass wildcard()(Code) | | Create "? extends T" from T.
never null |
|
|