Package EDU.purdue.cs.bloat.reflect
Interface ClassInfo
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FieldInfoaddNewField(int modifiers, int typeIndex, int nameIndex)Factory method that creates a new field in the class being modeledFieldInfoaddNewField(int modifiers, int typeIndex, int nameIndex, int cvNameIndex, int constantValueIndex)Factory method that creates a new field with a constant value in the class being modeledMethodInfoaddNewMethod(int modifiers, int typeIndex, int nameIndex, int exceptionIndex, int[] exceptionTypeIndices, int codeIndex)Adds a new method to this class.intclassIndex()Get the index into the constant pool of class.voidcommit()Commit any changes to the file or to the virtual machine.voidcommitOnly(java.util.Set methods, java.util.Set fields)Commits only certain methods and fields.Constant[]constants()Returns an array of the constants in the constant pool.voiddeleteField(int nameIndex)Deletes a field from this classvoiddeleteMethod(int nameIndex, int typeIndex)Deletes a method from this classFieldInfo[]fields()Get an array of FieldInfo structures for each field in the class.int[]interfaceIndices()Get the indices into the constant pool of class's interfaces.ClassInfoLoaderloader()Get the class info loader for the class.MethodInfo[]methods()Returns an array of MethodInfo structures for each method in the class.intmodifiers()Get the modifiers of the class.java.lang.Stringname()Get the name of the class.voidprint(java.io.PrintStream out)voidprint(java.io.PrintWriter out)voidsetClassIndex(int index)Set the index into the constant pool of class.voidsetConstants(Constant[] constants)Set all the constants in the constant pool.voidsetInterfaceIndices(int[] indices)Set the indices into the constant pool of class's interfaces.voidsetMethods(MethodInfo[] methods)Sets the methods in this class.voidsetModifiers(int modifiers)Set the modifiers of the class.voidsetSuperclassIndex(int index)Set the index into the constant pool of class's superclass.intsuperclassIndex()Get the index into the constant pool of class's superclass.java.lang.StringtoString()
-
-
-
Method Detail
-
loader
ClassInfoLoader loader()
Get the class info loader for the class.- Returns:
- The class info loader.
-
name
java.lang.String name()
Get the name of the class.- Returns:
- The name of the class.
-
classIndex
int classIndex()
Get the index into the constant pool of class.- Returns:
- The index of the class.
-
superclassIndex
int superclassIndex()
Get the index into the constant pool of class's superclass.- Returns:
- The index of the superclass.
-
interfaceIndices
int[] interfaceIndices()
Get the indices into the constant pool of class's interfaces.- Returns:
- The indices of the interfaces.
-
setClassIndex
void setClassIndex(int index)
Set the index into the constant pool of class.- Parameters:
index- The index of the class.
-
setSuperclassIndex
void setSuperclassIndex(int index)
Set the index into the constant pool of class's superclass.- Parameters:
index- The index of the superclass.
-
setInterfaceIndices
void setInterfaceIndices(int[] indices)
Set the indices into the constant pool of class's interfaces.- Parameters:
indices- The indices of the interfaces.
-
setModifiers
void setModifiers(int modifiers)
Set the modifiers of the class. The values correspond to the constants in the Modifiers class.- Parameters:
modifiers- A bit vector of modifier flags for the class.- See Also:
Modifiers
-
modifiers
int modifiers()
Get the modifiers of the class. The values correspond to the constants in the Modifiers class.- Returns:
- A bit vector of modifier flags for the class.
- See Also:
Modifiers
-
fields
FieldInfo[] fields()
Get an array of FieldInfo structures for each field in the class.- Returns:
- An array of FieldInfo structures.
- See Also:
FieldInfo
-
methods
MethodInfo[] methods()
Returns an array of MethodInfo structures for each method in the class.
-
setMethods
void setMethods(MethodInfo[] methods)
Sets the methods in this class.
-
constants
Constant[] constants()
Returns an array of the constants in the constant pool.
-
setConstants
void setConstants(Constant[] constants)
Set all the constants in the constant pool.- Parameters:
constants- The array of Constants.- See Also:
Constant
-
commit
void commit()
Commit any changes to the file or to the virtual machine.
-
commitOnly
void commitOnly(java.util.Set methods, java.util.Set fields)Commits only certain methods and fields.- Parameters:
methods- Methods (MethodInfos) to commit. If null, all methods are committed.fields- Fields (FieldInfos) to commit. If null, all fields are committed.
-
addNewField
FieldInfo addNewField(int modifiers, int typeIndex, int nameIndex)
Factory method that creates a new field in the class being modeled
-
addNewField
FieldInfo addNewField(int modifiers, int typeIndex, int nameIndex, int cvNameIndex, int constantValueIndex)
Factory method that creates a new field with a constant value in the class being modeled- Parameters:
cvNameIndex- The index in the class's constant pool for the UTF8 constant "ConstantValue"constantValueIndex- The index in the class's constant pool for the constant value
-
deleteField
void deleteField(int nameIndex)
Deletes a field from this class- Parameters:
nameIndex- Index in the constant pool of the name of the field to be deleted- Throws:
java.lang.IllegalArgumentException- The class modeled by thisClassInfodoes not contain a field whose name is at the given index
-
deleteMethod
void deleteMethod(int nameIndex, int typeIndex)Deletes a method from this class- Parameters:
nameIndex- Index in the constant pool of the name of the method to be deletedtypeIndex- Index in the constant pool of the type of the method to be deleted- Throws:
java.lang.IllegalArgumentException- The class modeled by thisClassInfodoes not contain a method whose name and type are not at the given indices
-
addNewMethod
MethodInfo addNewMethod(int modifiers, int typeIndex, int nameIndex, int exceptionIndex, int[] exceptionTypeIndices, int codeIndex)
Adds a new method to this class.- Parameters:
modifiers- Themodifiersfor the new methodtypeIndex- The index of the type (conglomeration of the parameter types and the return type) for this method in the class's constant poolnameIndex- The index of the name of the method in the class's constant poolexceptionIndex- The index of the UTF8 string "Exceptions" in the class's constant poolexceptionTypeIndices- The indices in the class's constant pool of the type of the exceptions thrown by this methodcodeIndex- The index of the UTF8 string "Code" in the class's constant pool
-
print
void print(java.io.PrintStream out)
-
print
void print(java.io.PrintWriter out)
-
toString
java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-