gnu.bytecode
public class ClassType extends ObjectType implements AttrContainer, Externalizable
Field Summary | |
---|---|
int | access_flags |
Method | constructor |
static ClassType[] | noClasses |
Constructor Summary | |
---|---|
ClassType() | |
ClassType(String class_name) |
Method Summary | |
---|---|
Field | addField()
Add a new field to this class. |
Field | addField(String name)
Add a new field to this class, and name the field. |
Field | addField(String name, Type type) |
Field | addField(String name, Type type, int flags) |
void | addFields() Use reflection to add all the declared fields of this class.
|
void | addInterface(ClassType newInterface) Add an interface to the list of implemented interfaces. |
Method | addMethod(String name) |
Method | addMethod(String name, int flags) |
Method | addMethod(String name, Type[] arg_types, Type return_type, int flags) |
Method | addMethod(String name, int flags, Type[] arg_types, Type return_type) Add a method to this ClassType.
|
Method | addMethod(String name, String signature, int flags) |
void | addMethods(Class clas) Use reflection to add all the declared methods of this class.
|
void | cleanupAfterCompilation() Clear various object references, to help garbage collection. |
int | compare(Type other) |
int | countMethods(Filter filter, int searchSupers) Count methods matching a given filter. |
void | doFixups() Do various fixups after generating code but before we can write it out.
|
Attribute | getAttributes() |
short | getClassfileMajorVersion() |
short | getClassfileMinorVersion() |
CpoolEntry | getConstant(int i) |
ConstantPool | getConstants() |
Field | getDeclaredField(String name) Find a field with the given name declared in this class. |
Method | getDeclaredMethod(String name, Type[] arg_types) Look for a matching method. |
Method | getDeclaredMethod(String name, int argCount) Get a method with matching name and number of arguments. |
Method | getDeclaredMethods() |
Field | getField(String name, int mask) Find a field with the given name declared in this class or its ancestors. |
Field | getField(String name) Find a field with the given name declared in this class or its ancestors. |
int | getFieldCount() |
Field | getFields() Get the fields of this class. |
ClassType[] | getInterfaces() |
Method[] | getMatchingMethods(String name, Type[] paramTypes, int flags) |
Method | getMethod(Method method) Add a method to this ClassType.
|
Method | getMethod(String name, Type[] arg_types) |
int | getMethodCount() |
Method | getMethods() Get the methods of this class. |
Method[] | getMethods(Filter filter, boolean searchSupers) |
Method[] | getMethods(Filter filter, int searchSupers) Get methods matching a given filter. |
int | getMethods(Filter filter, int searchSupers, Method[] result, int offset) Helper to get methods satisfying a filtering predicate. |
int | getMethods(Filter filter, int searchSupers, Vector result, String context) Helper to get methods satisfying a filtering predicate. |
int | getModifiers() Return the modifiers (access flags) for this class. |
ClassType | getOuterLinkType() |
String | getPackageName() |
ClassType | getSuperclass() |
boolean | hasOuterLink() |
boolean | implementsInterface(ClassType iface) True if this class/interface implements the interface iface. |
boolean | isAccessible(ClassType declaring, int modifiers) Check if a component is accessible from this class. |
boolean | isInterface() |
boolean | isSubclass(String cname) A more efficient version of isSubclass(ClassType.make(cname)).
|
boolean | isSubclass(ClassType other) |
static ClassType | make(String name) Find a ClassType with the given name, or create a new one.
|
static ClassType | make(String name, ClassType superClass) |
void | readExternal(ObjectInput in) |
Object | readResolve() |
void | setAttributes(Attribute attributes) |
void | setClassfileVersion(int major, int minor) |
void | setClassfileVersionJava5() |
void | setInterface(boolean val) |
void | setInterfaces(ClassType[] interfaces) |
void | setModifiers(int flags) Set the modifiers (access flags) for this class. |
void | setName(String name) Sets the name of the class being defined in this classfile. |
Field | setOuterLink(ClassType outer) Note that this class needs an other link ("this$0") field.
|
void | setSourceFile(String name) Set the name of the SourceFile associated with this class. |
void | setStratum(String stratum) Create a SourceDebugExtAttr , if needed, and
set the "stratum". |
void | setSuper(String name)
Set the superclass of the is class. |
void | setSuper(ClassType superClass) |
String | toString() |
static byte[] | to_utf8(String str)
Convert a String to a Utf8 byte array. |
void | writeExternal(ObjectOutput out) |
byte[] | writeToArray() |
void | writeToFile(String filename) |
void | writeToFile() |
void | writeToStream(OutputStream stream) |
Parameters: name the name of the new field
Parameters: clas should be the same as getReflectClass().
Parameters: filter to select methods to return searchSupers 0 if only current class should be searched, 1 if superclasses should also be searched, 2 if super-interfaces should also be search
Returns: number of methods that match
Returns: the matching field, or null if there is no such field.
Parameters: name method name arg_types parameter types that must match. Can also be null, to match any parameter type list. Otherwise, an element of arg_types must be the same type (equals), though a null element of arg_types is a wildcard that matches any type.
Parameters: name the name of the field. mask of match a field whose modifiers has one of these bits set. Howeve, if mask is -1, ignore the access flags.
Returns: the matching field, or null if there is no such field.
Returns: the matching field, or null if there is no such field.
Returns: the interfaces this class is declared to implement (not those inherited from its superclass/superinterfaces).
Parameters: filter to select methods to return searchSupers 0 if only current class should be searched, 1 if superclasses should also be searched, 2 if super-interfaces should also be searched
Returns: a fresh array containing the methods satisfying the filter
Deprecated:
Helper to get methods satisfying a filtering predicate.Parameters: filter to select methods to return searchSupers 0 if only current class should be searched, 1 if superclasses should also be searched, 2 if super-interfaces should also be searched result array to place selected methods in offset start of where in result to place result
Returns: number of methods placed in result array
Parameters: filter to select methods to return searchSupers 0 if only current class should be searched, 1 if superclasses should also be searched, 2 if super-interfaces should also be searched result Vector to add selected methods in context If non-null, skip if class not visible in named package.
Returns: number of methods placed in result array
Parameters: declaring the class containing the component (a field, method, or inner class) modifiers the access flags of the component
Returns: true if the specified component can be accessed from this class.
Parameters: cname a class name - cannot be an interface name
Parameters: name the name of the class (e..g. "java.lang.String").
Parameters: name the name to give to the class
Parameters: outer the outer class
SourceDebugExtAttr
, if needed, and
set the "stratum". The stratum is typically a programming language
such as "JSP", "Scheme", or "Java" (the default).Parameters: name name of super class, or null if this is "Object".
Parameters: str the input String.
Returns: the input encoded as a utf8 byte array.
Serial Data: Write the class name (as given by getName()) using writeUTF.