fr.umlv.corosol.classfile
Interface JClassFile

All Superinterfaces:
JClassFileItem, JObject
All Known Implementing Classes:
DefaultJClassFile

public interface JClassFile
extends JClassFileItem

The JClassFile interface represents the ClassFile structure described in chapter 4 of the JVM Specification.

Author:
Christophe Deleray

Method Summary
 void addAttribute(JAttribute attribute)
          Adds an attributes of this class file.
 void addConstructor(JClassMember constructor)
          Adds and returns a new constructor to the class defined by this class file.
 JClassMember addConstructor(java.lang.String descriptor, int accessFlags, JAttribute[] attributes)
          Adds and returns a new constructor to the class defined by this class file.
 JClassMember addDefaultConstructor(int accessFlags)
          Adds and returns a default constructor to the class defined by this class file.
 void addField(JClassMember field)
          Adds and returns a new field to the class defined by this class file.
 JClassMember addField(java.lang.String name, java.lang.String descriptor, int accessFlags, JAttribute[] attributes)
          Adds and returns a new field to the class defined by this class file.
 void addInterface(java.lang.String name)
          Adds the specified super interface to the class defined by this class file.
 void addMethod(JClassMember method)
          Adds and returns a new method to the class defined by this class file.
 JClassMember addMethod(java.lang.String name, java.lang.String descriptor, int accessFlags, JAttribute[] attributes)
          Adds and returns a new method to the class defined by this class file.
 int getAccessFlags()
          Returns the mask of flags used to denote access permissions to and properties of the class or interface represented by this JClassFile object.
 JAttribute[] getAttributes()
          Returns an array of attributes of this class file.
 JClassMember getDeclaredConstructor(java.lang.String desc)
          Returns the constructor with the specified descriptor.
 JClassMember[] getDeclaredConstructors()
          Returns an array of JClassMember object, corresponding to the constructors declared by the class defined by this class file.
 JClassMember getDeclaredField(java.lang.String name)
          Returns the field with the specified name.
 JClassMember[] getDeclaredFields()
          Returns an array of JClassMember object, corresponding to the fields declared by the class defined by this class file.
 JClassMember getDeclaredMethod(java.lang.String name, java.lang.String desc)
          Returns the method with the specified name and descriptor.
 JClassMember[] getDeclaredMethods()
          Returns an array of JClassMember object, corresponding to the methods declared by the class defined by this class file.
 int[] getInterfaceIndex()
          Returns an array containing index of constant pool entry describing a super interface of the class defined by this class file.
 java.lang.String[] getInterfaceNames()
          Returns an array of String object, corresponding to the name of super interface of the class defined by this class file.
 int getMajorVersion()
          Returns the major version of the classfile.
 int getMinorVersion()
          Returns the minor version of the classfile.
 java.lang.String getName()
          Returns the name of the class represented by this class file.
 int getSuperclassIndex()
          Returns the index into a CONSTANT_Class_info constant pool entry representing the superclass of the class defined by this class file.
 java.lang.String getSuperclassName()
          Returns the name of the superclass of the class represented by this class file.
 int getThisClassIndex()
          Returns the index of the CONSTANT_Class_info constant pool entry representing the class or interface defined by this class file.
 void removeDefaultConstructor()
          Removes the default constructor of the class defined by this class file.
 void setAccessFlags(int accessFlags)
          Sets the mask of flags used to denote access permissions to and properties of the class or interface represented by this JClassFile object.
 void setDeclaredConstructors(JClassMember[] constructors)
          Sets the constructors of the class defined by this class file.
 void setDeclaredFields(JClassMember[] fields)
          Sets the declared fields of the class defined by this class file.
 void setDeclaredMethods(JClassMember[] methods)
          Sets the methods of the class defined by this class file.
 void setInterfaceIndex(int[] interfaceIndex)
          Sets the array containing index of constant pool entry describing a super interface of the class defined by this class file.
 void setMajorVersion(int majorVersion)
          Sets the major version of the classfile.
 void setMinorVersion(int minorVersion)
          Sets the minor version of the classfile.
 void setName(java.lang.String name)
          Sets the name of the class represented by this class file.
 void setSuperclassIndex(int superclassIndex)
          Sets the index into a CONSTANT_Class_info constant pool entry representing the superclass of the class defined by this class file.
 void setSuperclassName(java.lang.String name)
          Sets the name of the superclass of the class represented by this class file.
 void setThisClassIndex(int thisClassIndex)
          Sets the index into a CONSTANT_Class_info constant pool entry representing the class or interface defined by this class file.
 java.lang.String toString()
          Returns a string representation of this classfile.
 
Methods inherited from interface fr.umlv.corosol.classfile.JClassFileItem
getConstantPool, readItem, setConstantPool, writeItem
 

Method Detail

getMinorVersion

int getMinorVersion()
Returns the minor version of the classfile.


setMinorVersion

void setMinorVersion(int minorVersion)
Sets the minor version of the classfile.

Parameters:
minorVersion - the minor version of the classfile.

getMajorVersion

int getMajorVersion()
Returns the major version of the classfile.


setMajorVersion

void setMajorVersion(int majorVersion)
Sets the major version of the classfile.

Parameters:
majorVersion - the major version of the classfile.

getAccessFlags

int getAccessFlags()
Returns the mask of flags used to denote access permissions to and properties of the class or interface represented by this JClassFile object.

Returns:
the access flags of the class

setAccessFlags

void setAccessFlags(int accessFlags)
Sets the mask of flags used to denote access permissions to and properties of the class or interface represented by this JClassFile object.

Parameters:
accessFlags - the access flags of the class

getThisClassIndex

int getThisClassIndex()
Returns the index of the CONSTANT_Class_info constant pool entry representing the class or interface defined by this class file.

Returns:
the index of a constant pool entry representing the class

setThisClassIndex

void setThisClassIndex(int thisClassIndex)
Sets the index into a CONSTANT_Class_info constant pool entry representing the class or interface defined by this class file.

Parameters:
thisClassIndex - the index of a constant pool entry representing the class

getSuperclassIndex

int getSuperclassIndex()
Returns the index into a CONSTANT_Class_info constant pool entry representing the superclass of the class defined by this class file. The index which is returned may be zero, and then the class has not superclass.

Returns:
the index of a constant pool entry representing the superclass of the class

setSuperclassIndex

void setSuperclassIndex(int superclassIndex)
Sets the index into a CONSTANT_Class_info constant pool entry representing the superclass of the class defined by this class file. The index which is returned may be zero, and then the class has not superclass.

Parameters:
superclassIndex - the index of a constant pool entry representing the superclass of the class

getInterfaceIndex

int[] getInterfaceIndex()
Returns an array containing index of constant pool entry describing a super interface of the class defined by this class file.

Returns:
an array of constant pool entry index describing super interfaces

setInterfaceIndex

void setInterfaceIndex(int[] interfaceIndex)
Sets the array containing index of constant pool entry describing a super interface of the class defined by this class file.

Parameters:
interfaceIndex - an array of index describing the super interfaces

getName

java.lang.String getName()
Returns the name of the class represented by this class file.

Returns:
the name of the class

setName

void setName(java.lang.String name)
Sets the name of the class represented by this class file.

Parameters:
name - the name of the class

getSuperclassName

java.lang.String getSuperclassName()
Returns the name of the superclass of the class represented by this class file.

Returns:
the name of the superclass

setSuperclassName

void setSuperclassName(java.lang.String name)
Sets the name of the superclass of the class represented by this class file.

Parameters:
name - the name of the superclass

getInterfaceNames

java.lang.String[] getInterfaceNames()
Returns an array of String object, corresponding to the name of super interface of the class defined by this class file.

Returns:
an array of String, describing the name of the super interfaces

addInterface

void addInterface(java.lang.String name)
Adds the specified super interface to the class defined by this class file.

Parameters:
name - the name of the super interface

getDeclaredFields

JClassMember[] getDeclaredFields()
Returns an array of JClassMember object, corresponding to the fields declared by the class defined by this class file.

Returns:
an array of JClassMember representing fields

getDeclaredMethods

JClassMember[] getDeclaredMethods()
Returns an array of JClassMember object, corresponding to the methods declared by the class defined by this class file.

Returns:
an array of JClassMember representing methods

getDeclaredConstructors

JClassMember[] getDeclaredConstructors()
Returns an array of JClassMember object, corresponding to the constructors declared by the class defined by this class file.

Returns:
an array of JClassMember representing constructors

getDeclaredField

JClassMember getDeclaredField(java.lang.String name)
Returns the field with the specified name.

Parameters:
name - the field name
Returns:
a JClassMember object representing the specified field or null if it is not declared by this class.

getDeclaredMethod

JClassMember getDeclaredMethod(java.lang.String name,
                               java.lang.String desc)
Returns the method with the specified name and descriptor.

Parameters:
name - the method name
desc - the method descriptor
Returns:
a JClassMember object representing the specified method or null if it is not declared by this class.

getDeclaredConstructor

JClassMember getDeclaredConstructor(java.lang.String desc)
Returns the constructor with the specified descriptor.

Parameters:
desc - the constructor descriptor
Returns:
a JClassMember object representing the specified constructor or null if it is not declared by this class.

setDeclaredFields

void setDeclaredFields(JClassMember[] fields)
Sets the declared fields of the class defined by this class file.

Parameters:
fields - an array of new fields

setDeclaredMethods

void setDeclaredMethods(JClassMember[] methods)
Sets the methods of the class defined by this class file.

Parameters:
methods - an array of new methods

setDeclaredConstructors

void setDeclaredConstructors(JClassMember[] constructors)
Sets the constructors of the class defined by this class file.

Parameters:
constructors - an array of new constructors

addField

JClassMember addField(java.lang.String name,
                      java.lang.String descriptor,
                      int accessFlags,
                      JAttribute[] attributes)
Adds and returns a new field to the class defined by this class file.

Parameters:
name - the field name
descriptor - the field descriptor
accessFlags - the access flag of the field
attributes - the field attributes
Returns:
the new field

addField

void addField(JClassMember field)
Adds and returns a new field to the class defined by this class file.

Parameters:
field - a new field

addMethod

JClassMember addMethod(java.lang.String name,
                       java.lang.String descriptor,
                       int accessFlags,
                       JAttribute[] attributes)
Adds and returns a new method to the class defined by this class file.

Parameters:
name - the method name
descriptor - the method descriptor
accessFlags - the access flag of the method
attributes - the method attributes
Returns:
the new method

addMethod

void addMethod(JClassMember method)
Adds and returns a new method to the class defined by this class file.

Parameters:
method - a new method

addConstructor

JClassMember addConstructor(java.lang.String descriptor,
                            int accessFlags,
                            JAttribute[] attributes)
Adds and returns a new constructor to the class defined by this class file.

Parameters:
descriptor - the constructor descriptor
accessFlags - the access flag of the constructor
attributes - the constructor attributes
Returns:
the new constructor

addConstructor

void addConstructor(JClassMember constructor)
Adds and returns a new constructor to the class defined by this class file.

Parameters:
constructor - a new constructor

addDefaultConstructor

JClassMember addDefaultConstructor(int accessFlags)
Adds and returns a default constructor to the class defined by this class file.

Parameters:
accessFlags - the access flag of the default constructor
Returns:
the new default constructor

removeDefaultConstructor

void removeDefaultConstructor()
Removes the default constructor of the class defined by this class file.


getAttributes

JAttribute[] getAttributes()
Returns an array of attributes of this class file.

Returns:
an array of attributes

addAttribute

void addAttribute(JAttribute attribute)
Adds an attributes of this class file.

Parameters:
attribute - an attribute

toString

java.lang.String toString()
Returns a string representation of this classfile.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this classfile