com.sun.codemodel
Class JClass

java.lang.Object
  extended by com.sun.codemodel.JType
      extended by com.sun.codemodel.JClass
Direct Known Subclasses:
JArrayClass, JDefinedClass, JNullType

public abstract class JClass
extends JType

A Java class.


Constructor Summary
protected JClass(JCodeModel _owner)
           
 
Method Summary
abstract  JClass _extends()
          Gets the super class of this class.
abstract  java.util.Iterator _implements()
          Iterates all interfaces directly implemented by this class/interface.
abstract  JPackage _package()
          Gets the package to which this class belongs.
 JClass array()
          Create an array type from this type.
 JExpression dotclass()
           
 java.lang.String fullName()
          Gets the fully qualified name of this class.
 void generate(JFormatter f)
           
 JPrimitiveType getPrimitiveType()
          If this class represents one of the wrapper classes defined in the java.lang package, return the corresponding primitive type.
 boolean isAssignableFrom(JClass derived)
          Checks the relationship between two classes.
abstract  boolean isInterface()
          Checks if this object represents an interface.
abstract  java.lang.String name()
          Gets the name of this class.
 JCodeModel owner()
          Gets the JCodeModel object to which this object belongs.
 JInvocation staticInvoke(JMethod method)
          Generates a static method invocation.
 JInvocation staticInvoke(java.lang.String method)
          Generates a static method invocation.
 JFieldRef staticRef(JVar field)
          Static field reference.
 JFieldRef staticRef(java.lang.String field)
          Static field reference.
 java.lang.String toString()
           
 
Methods inherited from class com.sun.codemodel.JType
binaryName, elementType, isArray, isPrimitive, isReference, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JClass

protected JClass(JCodeModel _owner)
Method Detail

name

public abstract java.lang.String name()
Gets the name of this class.

Specified by:
name in class JType
Returns:
name of this class, without any qualification. For example, this method returns "String" for java.lang.String.

fullName

public java.lang.String fullName()
Gets the fully qualified name of this class.

Specified by:
fullName in class JType

_package

public abstract JPackage _package()
Gets the package to which this class belongs.


owner

public final JCodeModel owner()
Gets the JCodeModel object to which this object belongs.

Specified by:
owner in class JType

_extends

public abstract JClass _extends()
Gets the super class of this class.

Returns:
Returns the JClass representing the superclass of the entity (class or interface) represented by this JClass. If this JClass represents either the Object class, or an interface, then null is returned.

_implements

public abstract java.util.Iterator _implements()
Iterates all interfaces directly implemented by this class/interface.

Returns:
A non-null valid iterator that iterates all JClass objects that represents those interfaces implemented by this object.

isInterface

public abstract boolean isInterface()
Checks if this object represents an interface.


getPrimitiveType

public JPrimitiveType getPrimitiveType()
If this class represents one of the wrapper classes defined in the java.lang package, return the corresponding primitive type. Otherwise null.


isAssignableFrom

public final boolean isAssignableFrom(JClass derived)
Checks the relationship between two classes.

This method works in the same way as Class.isAssignableFrom(java.lang.Class) works. For example, baseClass.isAssignableFrom(derivedClass)==true.


array

public JClass array()
Description copied from class: JType
Create an array type from this type. This method is undefined for primitive void type, which doesn't have any corresponding array representation.

Specified by:
array in class JType
Returns:
A JType representing the one-dimensional array type whose element type is this type

toString

public java.lang.String toString()
Overrides:
toString in class JType

dotclass

public final JExpression dotclass()

staticInvoke

public final JInvocation staticInvoke(JMethod method)
Generates a static method invocation.


staticInvoke

public final JInvocation staticInvoke(java.lang.String method)
Generates a static method invocation.


staticRef

public final JFieldRef staticRef(java.lang.String field)
Static field reference.


staticRef

public final JFieldRef staticRef(JVar field)
Static field reference.


generate

public void generate(JFormatter f)