public abstract class JClass extends JType
 To be exact, this object represents an "use" of a reference type,
 not necessarily a declaration of it, which is modeled as JDefinedClass.
| Modifier and Type | Field and Description | 
|---|---|
| protected static JTypeVar[] | EMPTY_ARRAYSometimes useful reusable empty array. | 
| Modifier | Constructor and Description | 
|---|---|
| protected  | JClass(JCodeModel _owner) | 
| Modifier and Type | Method and Description | 
|---|---|
| abstract JClass | _extends()Gets the super class of this class. | 
| abstract Iterator<JClass> | _implements()Iterates all super interfaces directly implemented by
 this class/interface. | 
| abstract JPackage | _package()Gets the package to which this class belongs. | 
| JClass | array()Create an array type of this type. | 
| JClass | boxify()Deprecated. 
 calling this method from  JClasswould be meaningless, since it's always guaranteed to
 return this. | 
| JExpression | dotclass() | 
| JClass | erasure()Returns the erasure of this type. | 
| void | generate(JFormatter f) | 
| JClass | getBaseClass(Class<?> baseType) | 
| JClass | getBaseClass(JClass baseType)Gets the parameterization of the given base type. | 
| JPrimitiveType | getPrimitiveType()If this class represents one of the wrapper classes
 defined in the java.lang package, return the corresponding
 primitive type. | 
| List<JClass> | getTypeParameters()If this class is parameterized, return the type parameter of the given index. | 
| abstract boolean | isAbstract()Checks if this class is an abstract class. | 
| boolean | isAssignableFrom(JClass derived)Checks the relationship between two classes. | 
| abstract boolean | isInterface()Checks if this object represents an interface. | 
| boolean | isParameterized()Returns true if this class is a parameterized class. | 
| abstract String | name()Gets the name of this class. | 
| JClass | narrow(Class<?>... clazz) | 
| JClass | narrow(Class<?> clazz)"Narrows" a generic class to a concrete class by specifying
 a type argument. | 
| JClass | narrow(JClass... clazz) | 
| JClass | narrow(JClass clazz)"Narrows" a generic class to a concrete class by specifying
 a type argument. | 
| JClass | narrow(JType type) | 
| JClass | narrow(List<? extends JClass> clazz) | 
| JClass | outer()Returns the class in which this class is nested, or null if
 this is a top-level class. | 
| JCodeModel | owner()Gets the JCodeModel object to which this object belongs. | 
| JInvocation | staticInvoke(JMethod method)Generates a static method invocation. | 
| JInvocation | staticInvoke(String method)Generates a static method invocation. | 
| JFieldRef | staticRef(JVar field)Static field reference. | 
| JFieldRef | staticRef(String field)Static field reference. | 
| protected abstract JClass | substituteParams(JTypeVar[] variables,
                List<JClass> bindings)Substitutes the type variables with their actual arguments. | 
| String | toString() | 
| JTypeVar[] | typeParams()Iterates all the type parameters of this class/interface. | 
| JType | unboxify()If this class is a wrapper type for a primitive, return the primitive type. | 
| JClass | wildcard()Create "? extends T" from T. | 
binaryName, compareTo, elementType, fullName, isArray, isPrimitive, isReference, parseprotected static final JTypeVar[] EMPTY_ARRAY
protected JClass(JCodeModel _owner)
public abstract String name()
public abstract JPackage _package()
public JClass outer()
public final JCodeModel owner()
public abstract JClass _extends()
public abstract Iterator<JClass> _implements()
JClass objects that represents those interfaces
                implemented by this object.public JTypeVar[] typeParams()
public abstract boolean isInterface()
public abstract boolean isAbstract()
public JPrimitiveType getPrimitiveType()
public JClass boxify()
JClass
 would be meaningless, since it's always guaranteed to
 return this.JTypeFor example, for "int", this method returns "java.lang.Integer".
public JType unboxify()
JTypeFor example, for "java.lang.Integer", this method returns "int".
public JClass erasure()
JTypepublic final boolean isAssignableFrom(JClass derived)
 This method works in the same way as Class.isAssignableFrom(Class)
 works. For example, baseClass.isAssignableFrom(derivedClass)==true.
public final JClass getBaseClass(JClass baseType)
For example, given the following
This method works like this:interface Foo extends List > {} interface Bar extends Foo
{} 
getBaseClass( Bar, List ) = List getBaseClass( Bar, Foo ) = Foo
getBaseClass( Foo extends Number>, Collection ) = Collection > getBaseClass( ArrayList extends BigInteger>, List ) = List extends BigInteger>
baseType - The class whose parameterization we are interested in.baseType in this type.
      or null if the type is not assignable to the base type.public JClass array()
JTypepublic JClass narrow(Class<?> clazz)
 .narrow(X) builds Set<X> from Set.
public JClass narrow(JClass clazz)
 .narrow(X) builds Set<X> from Set.
public List<JClass> getTypeParameters()
public final boolean isParameterized()
public final JClass wildcard()
protected abstract JClass substituteParams(JTypeVar[] variables, List<JClass> bindings)
 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.
public final JExpression dotclass()
public final JInvocation staticInvoke(JMethod method)
public final JInvocation staticInvoke(String method)
public void generate(JFormatter f)
Copyright © 2017 JBoss by Red Hat. All rights reserved.