|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--EDU.purdue.cs.bloat.editor.ClassEditor
A ClassEditor provides finer-grain access to a class than a CLassInfo object does. A ClassEditor takes a ClassInfo and extracts the class's constant pool, type, super class type, and the types of its interfaces. When editing is finished, changes are committed with the commit method.
ClassInfo
,
MethodEditor
Field Summary | |
static boolean |
DEBUG
|
Constructor Summary | |
ClassEditor(EditorContext context,
ClassInfo classInfo)
Constructor. |
|
ClassEditor(EditorContext context,
int modifiers,
java.lang.String className,
Type superType,
Type[] interfaces)
Creates a new ClassEditor for editing a class (or
interface) from scratch. |
Method Summary | |
void |
addInterface(java.lang.Class interfaceClass)
Adds an interface of the given class to the set of interfaces that the class implements. |
void |
addInterface(Type interfaceType)
Adds an interface of a given Type to the set of interfaces that the class implements. |
ClassInfo |
classInfo()
Get the ClassInfo object representing the class that being edited. |
void |
commit()
Commit any changes to the class since creation time. |
void |
commitOnly(java.util.Set methods,
java.util.Set fields)
Commits only certain methods and fields. |
ConstantPool |
constants()
Returns the constant pool for the class. |
EditorContext |
context()
Obtain the EditorContext for this ClassEditor. |
boolean |
equals(java.lang.Object o)
Two ClassEditors are equal if they edit the same class. |
FieldInfo[] |
fields()
Returns an array of FieldInfo structures for each field in the class. |
int |
hashCode()
A ClassEditor's hash code is based upon the hash code of the name of the class it edits. |
Type[] |
interfaces()
Returns the interfaces the class implements. |
boolean |
isAbstract()
|
boolean |
isDirty()
Returns true if the class has been modified. |
boolean |
isFinal()
|
boolean |
isInterface()
|
boolean |
isPrivate()
|
boolean |
isProtected()
|
boolean |
isPublic()
|
boolean |
isStatic()
|
boolean |
isSuper()
|
MethodInfo[] |
methods()
Returns an array of MethodInfo structures for each method in the class. |
int |
modifiers()
Returns the modifiers of the class. |
java.lang.String |
name()
Returns the name of the class represented by this ClassEditor. |
void |
setAbstract(boolean flag)
|
void |
setDirty(boolean dirty)
Sets this class's dirty flag. |
void |
setFinal(boolean flag)
|
void |
setInterface(boolean flag)
|
void |
setInterfaces(Type[] interfaces)
Returns the interfaces the class implements. |
void |
setPrivate(boolean flag)
|
void |
setProtected(boolean flag)
|
void |
setPublic(boolean flag)
|
void |
setStatic(boolean flag)
|
void |
setSuper(boolean flag)
|
void |
setType(Type type)
Sets the Type (descriptor) object for the class. |
Type |
superclass()
Returns a Type object for the class's superclass. |
java.lang.String |
toString()
|
Type |
type()
Returns the Type (descriptor) for the class. |
void |
visit(EditorVisitor visitor)
This class is visited by an EditorVisitor. |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static boolean DEBUG
Constructor Detail |
public ClassEditor(EditorContext context, ClassInfo classInfo)
context
- The EditorContext used to edit fields and methods.classInfo
- The ClassInfo structure of the class to edit.ClassInfo
,
ConstantPool
,
Type
public ClassEditor(EditorContext context, int modifiers, java.lang.String className, Type superType, Type[] interfaces)
ClassEditor
for editing a class (or
interface) from scratch. This constructor should not be invoked
direcly. Use EditorContext.newClass(int, String, Type,
Type[])
instead.Method Detail |
public boolean isDirty()
public void setDirty(boolean dirty)
public java.lang.String name()
public EditorContext context()
public ClassInfo classInfo()
public boolean isPublic()
public boolean isPrivate()
public boolean isProtected()
public boolean isStatic()
public boolean isFinal()
public boolean isSuper()
public boolean isAbstract()
public boolean isInterface()
public void setPublic(boolean flag)
public void setPrivate(boolean flag)
public void setProtected(boolean flag)
public void setStatic(boolean flag)
public void setFinal(boolean flag)
public void setSuper(boolean flag)
public void setAbstract(boolean flag)
public void setInterface(boolean flag)
public void setType(Type type)
type
- A Type.public Type type()
public Type superclass()
public void addInterface(java.lang.Class interfaceClass)
public void addInterface(Type interfaceType)
public void setInterfaces(Type[] interfaces)
interfaces
- An array of Types.public Type[] interfaces()
public int modifiers()
Modifiers
public FieldInfo[] fields()
public MethodInfo[] methods()
public ConstantPool constants()
public void commit()
public void commitOnly(java.util.Set methods, java.util.Set fields)
methods
- Methods (MethodInfos) to commit. If
null, all methods are committed.fields
- Fields (FieldInfos) to commit. If null,
all fields are committed.public void visit(EditorVisitor visitor)
public boolean equals(java.lang.Object o)
public int hashCode()
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |