com.caucho.bytecode
Class JavaClass

java.lang.Object
  extended by com.caucho.bytecode.JAnnotationObject
      extended by com.caucho.bytecode.JClass
          extended by com.caucho.bytecode.JavaClass
All Implemented Interfaces:
JType

public class JavaClass
extends JClass

Represents a java class.


Field Summary
static int ACC_FINAL
           
static int ACC_PRIVATE
           
static int ACC_PROTECTED
           
static int ACC_PUBLIC
           
static int ACC_STATIC
           
static int ACC_SUPER
           
static int MAGIC
           
 
Fields inherited from class com.caucho.bytecode.JClass
BOOLEAN, BYTE, CHAR, DOUBLE, FLOAT, INT, LONG, OBJECT, SHORT, STRING, VOID
 
Constructor Summary
JavaClass()
           
JavaClass(JavaClassLoader loader)
           
 
Method Summary
 void addAttribute(Attribute attr)
          Adds an attribute
 void addField(JavaField field)
          Adds a field
 void addInterface(java.lang.String className)
          Adds an interface.
 void addMethod(JavaMethod method)
          Adds a method
 JavaField createField(java.lang.String name, java.lang.String descriptor)
           
 JavaMethod createMethod(java.lang.String name, java.lang.String descriptor)
           
 JavaMethod findMethod(java.lang.String name, java.lang.String descriptor)
          Finds a method.
 int getAccessFlags()
          Gets the access flags.
 JAnnotation getAnnotation(java.lang.String className)
          Returns the annotation.
 Attribute getAttribute(java.lang.String name)
          Returns the attribute.
 java.util.ArrayList<Attribute> getAttributeList()
          Returns the methods.
 JavaClassLoader getClassLoader()
          Returns the loader.
 ConstantPool getConstantPool()
          Returns the class's constant pool.
 JMethod[] getConstructors()
          Returns the array of declared methods.
 JAnnotation[] getDeclaredAnnotations()
          Returns the declared annotations.
 JField[] getDeclaredFields()
          Returns the array of declared fields.
 JMethod[] getDeclaredMethods()
          Returns the array of declared methods.
 JavaField getField(java.lang.String name)
          Returns a fields.
 java.util.ArrayList<JavaField> getFieldList()
          Returns the fields.
 JField[] getFields()
          Returns the array of fields.
 java.util.ArrayList<java.lang.String> getInterfaceNames()
          Adds an interface.
 JClass[] getInterfaces()
          Gets the interfaces.
 int getMajor()
          Gets the major identifier of the class file.
 JavaMethod getMethod(java.lang.String name)
          Returns a method.
 JMethod getMethod(java.lang.String name, JClass[] paramTypes)
          Returns the matching method
 java.util.ArrayList<JavaMethod> getMethodList()
          Returns the methods.
 JMethod[] getMethods()
          Returns the matching method
 int getMinor()
          Gets the minor identifier of the class file.
 java.lang.String getName()
          Returns the class-equivalent name.
 JClass getSuperClass()
          Gets the super class name.
 java.lang.String getSuperClassName()
          Gets the super class name.
 java.lang.String getThisClass()
          Gets this class name.
 boolean isAbstract()
          Returns true for an abstract class.
 boolean isArray()
          Returns true for an array.
 boolean isAssignableFrom(java.lang.Class cl)
          Returns true if the class is assignable from the argument.
 boolean isAssignableFrom(JClass cl)
          Returns true if the class is assignable from the argument.
 boolean isAssignableTo(java.lang.Class cl)
          Returns true if the class is assignable from the argument.
 boolean isFinal()
          Returns true for a final class.
 boolean isInterface()
          Returns true for an interface.
 boolean isPrimitive()
          Returns true for a primitive class.
 boolean isPublic()
          Returns true for a public class.
 void setAccessFlags(int flags)
          Sets the access flags.
 void setMajor(int major)
          Sets the major identifier of the class file.
 void setMinor(int minor)
          Sets the minor identifier of the class file.
 void setSuperClass(java.lang.String className)
          Sets the super class.
 void setThisClass(java.lang.String className)
          Sets this class.
 void setURL(java.net.URL url)
          Sets the URL.
 void setWrite(boolean isWrite)
           
 java.lang.String toString()
           
 void write(WriteStream os)
          Writes the class to the output.
 
Methods inherited from class com.caucho.bytecode.JClass
equals, getActualTypeArguments, getComponentType, getConstructor, getJavaClass, getPrintName, getRawType, getShortName, getSimpleName, hashCode
 
Methods inherited from class com.caucho.bytecode.JAnnotationObject
getAnnotation, isAnnotationPresent, isAnnotationPresent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAGIC

public static final int MAGIC
See Also:
Constant Field Values

ACC_PUBLIC

public static final int ACC_PUBLIC
See Also:
Constant Field Values

ACC_PRIVATE

public static final int ACC_PRIVATE
See Also:
Constant Field Values

ACC_PROTECTED

public static final int ACC_PROTECTED
See Also:
Constant Field Values

ACC_STATIC

public static final int ACC_STATIC
See Also:
Constant Field Values

ACC_FINAL

public static final int ACC_FINAL
See Also:
Constant Field Values

ACC_SUPER

public static final int ACC_SUPER
See Also:
Constant Field Values
Constructor Detail

JavaClass

public JavaClass()

JavaClass

public JavaClass(JavaClassLoader loader)
Method Detail

getClassLoader

public JavaClassLoader getClassLoader()
Returns the loader.


setWrite

public void setWrite(boolean isWrite)

setURL

public void setURL(java.net.URL url)
Sets the URL.


setMajor

public void setMajor(int major)
Sets the major identifier of the class file.


getMajor

public int getMajor()
Gets the major identifier of the class file.


setMinor

public void setMinor(int minor)
Sets the minor identifier of the class file.


getMinor

public int getMinor()
Gets the minor identifier of the class file.


getConstantPool

public ConstantPool getConstantPool()
Returns the class's constant pool.


setAccessFlags

public void setAccessFlags(int flags)
Sets the access flags.


getAccessFlags

public int getAccessFlags()
Gets the access flags.


setThisClass

public void setThisClass(java.lang.String className)
Sets this class.


getThisClass

public java.lang.String getThisClass()
Gets this class name.


setSuperClass

public void setSuperClass(java.lang.String className)
Sets the super class.


getSuperClassName

public java.lang.String getSuperClassName()
Gets the super class name.


getSuperClass

public JClass getSuperClass()
Gets the super class name.

Specified by:
getSuperClass in interface JType
Specified by:
getSuperClass in class JClass

isFinal

public boolean isFinal()
Returns true for a final class.

Specified by:
isFinal in interface JType
Specified by:
isFinal in class JClass

isAbstract

public boolean isAbstract()
Returns true for an abstract class.

Specified by:
isAbstract in interface JType
Specified by:
isAbstract in class JClass

isPublic

public boolean isPublic()
Returns true for a public class.

Specified by:
isPublic in interface JType
Specified by:
isPublic in class JClass

isPrimitive

public boolean isPrimitive()
Returns true for a primitive class.

Specified by:
isPrimitive in interface JType
Specified by:
isPrimitive in class JClass

addInterface

public void addInterface(java.lang.String className)
Adds an interface.


getInterfaceNames

public java.util.ArrayList<java.lang.String> getInterfaceNames()
Adds an interface.


getInterfaces

public JClass[] getInterfaces()
Gets the interfaces.

Specified by:
getInterfaces in interface JType
Specified by:
getInterfaces in class JClass

addField

public void addField(JavaField field)
Adds a field


createField

public JavaField createField(java.lang.String name,
                             java.lang.String descriptor)

getFieldList

public java.util.ArrayList<JavaField> getFieldList()
Returns the fields.


getField

public JavaField getField(java.lang.String name)
Returns a fields.


addMethod

public void addMethod(JavaMethod method)
Adds a method


createMethod

public JavaMethod createMethod(java.lang.String name,
                               java.lang.String descriptor)

getMethodList

public java.util.ArrayList<JavaMethod> getMethodList()
Returns the methods.


isArray

public boolean isArray()
Returns true for an array.

Specified by:
isArray in interface JType
Specified by:
isArray in class JClass

isInterface

public boolean isInterface()
Returns true for an interface.

Specified by:
isInterface in interface JType
Specified by:
isInterface in class JClass

getMethod

public JavaMethod getMethod(java.lang.String name)
Returns a method.


findMethod

public JavaMethod findMethod(java.lang.String name,
                             java.lang.String descriptor)
Finds a method.


addAttribute

public void addAttribute(Attribute attr)
Adds an attribute


getAttributeList

public java.util.ArrayList<Attribute> getAttributeList()
Returns the methods.


getAttribute

public Attribute getAttribute(java.lang.String name)
Returns the attribute.


getName

public java.lang.String getName()
Returns the class-equivalent name.

Specified by:
getName in interface JType
Specified by:
getName in class JClass

isAssignableFrom

public boolean isAssignableFrom(JClass cl)
Returns true if the class is assignable from the argument.

Specified by:
isAssignableFrom in interface JType
Specified by:
isAssignableFrom in class JClass

isAssignableFrom

public boolean isAssignableFrom(java.lang.Class cl)
Returns true if the class is assignable from the argument.

Specified by:
isAssignableFrom in interface JType
Specified by:
isAssignableFrom in class JClass

isAssignableTo

public boolean isAssignableTo(java.lang.Class cl)
Returns true if the class is assignable from the argument.

Specified by:
isAssignableTo in interface JType
Specified by:
isAssignableTo in class JClass

getDeclaredMethods

public JMethod[] getDeclaredMethods()
Returns the array of declared methods.

Specified by:
getDeclaredMethods in interface JType
Specified by:
getDeclaredMethods in class JClass

getConstructors

public JMethod[] getConstructors()
Returns the array of declared methods.

Specified by:
getConstructors in class JClass

getMethod

public JMethod getMethod(java.lang.String name,
                         JClass[] paramTypes)
Returns the matching method

Specified by:
getMethod in interface JType
Specified by:
getMethod in class JClass

getMethods

public JMethod[] getMethods()
Returns the matching method

Specified by:
getMethods in interface JType
Specified by:
getMethods in class JClass

getDeclaredFields

public JField[] getDeclaredFields()
Returns the array of declared fields.

Specified by:
getDeclaredFields in interface JType
Specified by:
getDeclaredFields in class JClass

getFields

public JField[] getFields()
Returns the array of fields.

Specified by:
getFields in interface JType
Specified by:
getFields in class JClass

getDeclaredAnnotations

public JAnnotation[] getDeclaredAnnotations()
Returns the declared annotations.

Overrides:
getDeclaredAnnotations in class JAnnotationObject

getAnnotation

public JAnnotation getAnnotation(java.lang.String className)
Returns the annotation.

Overrides:
getAnnotation in class JAnnotationObject

write

public void write(WriteStream os)
           throws java.io.IOException
Writes the class to the output.

Throws:
java.io.IOException

toString

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