| java.lang.Object gnu.bytecode.Type gnu.bytecode.ObjectType gnu.bytecode.ClassType
All known Subclasses: gnu.expr.PairClassType,
Method Summary | |
public Field | addField() Add a new field to this class. | public Field | addField(String name) Add a new field to this class, and name the field. | final public Field | addField(String name, Type type) | final public Field | addField(String name, Type type, int flags) | public void | addFields() Use reflection to add all the declared fields of this class.
Does not add private or package-private fields.
Does not check for duplicate (already-known) fields. | public void | addInterface(ClassType newInterface) Add an interface to the list of implemented interfaces. | Method | addMethod() | public Method | addMethod(String name) | public Method | addMethod(String name, int flags) | public Method | addMethod(String name, Type[] arg_types, Type return_type, int flags) | public Method | addMethod(String name, int flags, Type[] arg_types, Type return_type) Add a method to this ClassType.
If an existing method matches, return that. | public Method | addMethod(String name, String signature, int flags) | public void | addMethods() Add methods using reflection if it was not already done. | public void | addMethods(Class clas) Use reflection to add all the declared methods of this class.
Does not add constructors nor private or package-private methods.
Does not check for duplicate (already-known) methods.
Parameters: clas - should be the same as getReflectClass(). | public int | compare(Type other) | final public int | countMethods(Filter filter, int searchSupers) Count methods matching a given filter. | public void | doFixups() Do various fixups after generating code but before we can write it out.
This includes assigning constant pool indexes where needed,
finalizing labels, etc. | public void | emitCoerceFromObject(CodeAttr code) | public int | getArity() Returns the number of type parameters. | final public Attribute | getAttributes() | final public CpoolEntry | getConstant(int i) | final public ConstantPool | getConstants() | public Field | getDeclaredField(String name) Find a field with the given name declared in this class. | public Method | getDeclaredMethod(String name, Type[] arg_types, Type return_type) Return a method with the given name and arguments types,
or null if none exists. | public Method | getDeclaredMethod(String name, Type[] arg_types) | public Method | getDeclaredMethod(String name, int argCount) Get a method with matching name and number of arguments. | public Method | getDeclaredMethods() | public Field | getField(String name) Find a field with the given name declared in this class or its ancestors. | final public int | getFieldCount() | final public Field | getFields() Get the fields of this class. | public ClassType[] | getInterfaces() | public Method[] | getMatchingMethods(String name, Type[] paramTypes, int flags) | public Method | getMethod(String name, Type[] arg_types) | public Method | getMethod(String name, Type[] arg_types, boolean concrete) | final public int | getMethodCount() | final public Method | getMethods() Get the methods of this class. | public Method[] | getMethods(Filter filter, boolean searchSupers) | public Method[] | getMethods(Filter filter, int searchSupers) Get methods matching a given filter. | public int | getMethods(Filter filter, int searchSupers, Method[] result, int offset) Helper to get methods satisfying a filtering predicate. | public int | getMethods(Filter filter, int searchSupers, Vector result, String context) Helper to get methods satisfying a filtering predicate.
Parameters: filter - to select methods to return Parameters: searchSupers - 0 if only current class should be searched,1 if superclasses should also be searched,2 if super-interfaces should also be search Parameters: result - Vector to add selected methods in Parameters: context - If non-null, skip if class not visible in named package. | final public int | getModifiers() Return the modifiers (access flags) for this class. | public String | getPackageName() | public TypeVariable[] | getParameters() Returns the type parameters. | SourceMap | getSourceMap() | public ClassType | getSuperclass() | final public boolean | implementsInterface(ClassType iface) True if this class/interface implements the interface iface. | public boolean | isAssignableTo(Type other) | final public boolean | isFinal() | final public boolean | isInterface() | final public boolean | isSubclass(ClassType other) | public static ClassType | make(String name) Find a ClassType with the given name, or create a new one.
Use this for "library classes", where you need the field/method types,
but not one where you are about to generate code for.
Parameters: name - the name of the class (e..g. | public static ClassType | make(String name, ClassType superClass) | Method | refineMethod(Method method) Return an equivalent method when the receiver is of this type. | final public void | setAttributes(Attribute attributes) | final public void | setInterface(boolean val) | public void | setInterfaces(ClassType[] interfaces) | final public void | setModifiers(int flags) Set the modifiers (access flags) for this class. | public void | setName(String name) Sets the name of the class being defined in this classfile. | public void | setSourceFile(String name) Set the name of the SourceFile associated with this class. | public void | setSuper(String name) Set the superclass of the is class. | public void | setSuper(ClassType superClass) | public Type | thisType() | public String | toString() | public static byte[] | to_utf8(String str) Convert a String to a Utf8 byte array.
Parameters: str - the input String. | public byte[] | writeToArray() | public void | writeToFile(String filename) | public void | writeToFile(File file) | public void | writeToFile() | public void | writeToStream(OutputStream stream) |
Code_name_index | int Code_name_index(Code) | | Constant pool index of "Code".
|
ConstantValue_name_index | int ConstantValue_name_index(Code) | | Constant pool index of "ConstantValue".
|
LineNumberTable_name_index | int LineNumberTable_name_index(Code) | | Constant pool index of "LineNumberTable".
|
LocalVariableTable_name_index | int LocalVariableTable_name_index(Code) | | Constant pool index of "LocalVariableTable".
|
access_flags | public int access_flags(Code) | | |
emitDebugInfo | boolean emitDebugInfo(Code) | | |
fields_count | int fields_count(Code) | | |
interfaceIndexes | int[] interfaceIndexes(Code) | | |
major_version | final public static int major_version(Code) | | |
methods_count | int methods_count(Code) | | |
minor_version | final public static int minor_version(Code) | | |
superClass | ClassType superClass(Code) | | The super (base) class of the current class.
X.superClass == null means the superClass has not been specified,
and defaults to java.lang.Object.
|
superClassIndex | int superClassIndex(Code) | | The constant pool index of the superClass, or -1 if unassigned.
|
thisClassIndex | int thisClassIndex(Code) | | |
ClassType | public ClassType()(Code) | | |
addField | public Field addField()(Code) | | Add a new field to this class.
|
addField | public Field addField(String name)(Code) | | Add a new field to this class, and name the field.
Parameters: name - the name of the new field |
addFields | public void addFields()(Code) | | Use reflection to add all the declared fields of this class.
Does not add private or package-private fields.
Does not check for duplicate (already-known) fields.
|
addInterface | public void addInterface(ClassType newInterface)(Code) | | Add an interface to the list of implemented interfaces.
|
addMethod | public Method addMethod(String name, int flags, Type[] arg_types, Type return_type)(Code) | | Add a method to this ClassType.
If an existing method matches, return that. Otherwise, create
a new one.
In contrast, the other addMethod methods always create new Methods.
|
addMethods | public void addMethods()(Code) | | Add methods using reflection if it was not already done.
|
addMethods | public void addMethods(Class clas)(Code) | | Use reflection to add all the declared methods of this class.
Does not add constructors nor private or package-private methods.
Does not check for duplicate (already-known) methods.
Parameters: clas - should be the same as getReflectClass(). |
countMethods | final public int countMethods(Filter filter, int searchSupers)(Code) | | Count methods matching a given filter.
Parameters: filter - to select methods to return Parameters: searchSupers - 0 if only current class should be searched,1 if superclasses should also be searched,2 if super-interfaces should also be search number of methods that match |
doFixups | public void doFixups()(Code) | | Do various fixups after generating code but before we can write it out.
This includes assigning constant pool indexes where needed,
finalizing labels, etc.
|
emitCoerceFromObject | public void emitCoerceFromObject(CodeAttr code)(Code) | | |
getArity | public int getArity()(Code) | | Returns the number of type parameters.
Returns -1 if this class has no parametrization info.
|
getDeclaredField | public Field getDeclaredField(String name)(Code) | | Find a field with the given name declared in this class.
the matching field, or null if there is no such field. |
getDeclaredMethod | public Method getDeclaredMethod(String name, Type[] arg_types, Type return_type)(Code) | | Return a method with the given name and arguments types,
or null if none exists.
Checks that the return type is the same as that given in argument,
or throws an error.
|
getDeclaredMethod | public Method getDeclaredMethod(String name, int argCount)(Code) | | Get a method with matching name and number of arguments.
|
getField | public Field getField(String name)(Code) | | Find a field with the given name declared in this class or its ancestors.
the matching field, or null if there is no such field. |
getFieldCount | final public int getFieldCount()(Code) | | |
getFields | final public Field getFields()(Code) | | Get the fields of this class.
|
getInterfaces | public ClassType[] getInterfaces()(Code) | | the interfaces this class is declared to implement(not those inherited from its superclass/superinterfaces). |
getMethodCount | final public int getMethodCount()(Code) | | |
getMethods | final public Method getMethods()(Code) | | Get the methods of this class.
|
getMethods | public Method[] getMethods(Filter filter, int searchSupers)(Code) | | Get methods matching a given filter.
Parameters: filter - to select methods to return Parameters: searchSupers - 0 if only current class should be searched,1 if superclasses should also be searched,2 if super-interfaces should also be search a fresh array containing the methods satisfying the filter |
getMethods | public int getMethods(Filter filter, int searchSupers, Method[] result, int offset)(Code) | | Helper to get methods satisfying a filtering predicate.
Parameters: filter - to select methods to return Parameters: searchSupers - 0 if only current class should be searched,1 if superclasses should also be searched,2 if super-interfaces should also be search Parameters: result - array to place selected methods in Parameters: offset - start of where in result to place result number of methods placed in result array |
getMethods | public int getMethods(Filter filter, int searchSupers, Vector result, String context)(Code) | | Helper to get methods satisfying a filtering predicate.
Parameters: filter - to select methods to return Parameters: searchSupers - 0 if only current class should be searched,1 if superclasses should also be searched,2 if super-interfaces should also be search Parameters: result - Vector to add selected methods in Parameters: context - If non-null, skip if class not visible in named package. number of methods placed in result array |
getModifiers | final public int getModifiers()(Code) | | Return the modifiers (access flags) for this class.
|
getParameters | public TypeVariable[] getParameters()(Code) | | Returns the type parameters.
Returns null if this class has no parametrization info.
|
implementsInterface | final public boolean implementsInterface(ClassType iface)(Code) | | True if this class/interface implements the interface iface.
|
isAssignableTo | public boolean isAssignableTo(Type other)(Code) | | true if values of this type can be assigned to otherwithout widening nor conversion. |
isFinal | final public boolean isFinal()(Code) | | |
isInterface | final public boolean isInterface()(Code) | | |
make | public static ClassType make(String name)(Code) | | Find a ClassType with the given name, or create a new one.
Use this for "library classes", where you need the field/method types,
but not one where you are about to generate code for.
Parameters: name - the name of the class (e..g. "java.lang.String"). |
refineMethod | Method refineMethod(Method method)(Code) | | Return an equivalent method when the receiver is of this type.
Return null if no more precise method exists.
|
setInterface | final public void setInterface(boolean val)(Code) | | |
setModifiers | final public void setModifiers(int flags)(Code) | | Set the modifiers (access flags) for this class.
|
setName | public void setName(String name)(Code) | | Sets the name of the class being defined in this classfile.
Parameters: name - the name to give to the class |
setSourceFile | public void setSourceFile(String name)(Code) | | Set the name of the SourceFile associated with this class.
|
setSuper | public void setSuper(String name)(Code) | | Set the superclass of the is class.
Parameters: name - name of super class, or null if this is "Object". |
to_utf8 | public static byte[] to_utf8(String str)(Code) | | Convert a String to a Utf8 byte array.
Parameters: str - the input String. the input encoded as a utf8 byte array. |
Methods inherited from gnu.bytecode.Type | abstract public Object coerceFromObject(Object obj)(Code)(Java Doc) public Object coerceToObject(Object obj)(Code)(Java Doc) abstract public int compare(Type other)(Code)(Java Doc) public void emitCoerceFrom(Type fromType, CodeAttr code)(Code)(Java Doc) public void emitCoerceFromObject(CodeAttr code)(Code)(Java Doc) public void emitCoerceTo(Type toType, CodeAttr code)(Code)(Java Doc) public void emitCoerceToObject(CodeAttr code)(Code)(Java Doc) public void emitIsInstance(CodeAttr code)(Code)(Java Doc) public static void flushTypeChanges()(Code)(Java Doc) public static void free(java.util.Map t)(Code)(Java Doc) public static Type fullSignatureToType(String sig, int[] offset)(Code)(Java Doc) public Type getImplementationType()(Code)(Java Doc) static java.util.Hashtable getMapNameToType()(Code)(Java Doc) public String getName()(Code)(Java Doc) public java.lang.Class getReflectClass()(Code)(Java Doc) final public String getSignature()(Code)(Java Doc) final public int getSize()(Code)(Java Doc) public static Type getType(String name)(Code)(Java Doc) public boolean isArray()(Code)(Java Doc) abstract public boolean isAssignableTo(Type other)(Code)(Java Doc) public boolean isInstance(Object obj)(Code)(Java Doc) public static boolean isMoreSpecific(Type[] t1, Type[] t2)(Code)(Java Doc) public boolean isSubtype(Type other)(Code)(Java Doc) public static boolean isValidJavaTypeName(String name)(Code)(Java Doc) final public boolean isVoid()(Code)(Java Doc) public static Type lookupType(String name)(Code)(Java Doc) public static Type lowestCommonSuperType(Type t1, Type t2)(Code)(Java Doc) public static Type make(Class reflectClass)(Code)(Java Doc) public Type promote()(Code)(Java Doc) Method refineMethod(Method method)(Code)(Java Doc) public static void registerTypeForClass(Class clas, Type type)(Code)(Java Doc) public static void registerTypeForName(String name, Type type)(Code)(Java Doc) public static void reset()(Code)(Java Doc) protected void setSignature(String sig)(Code)(Java Doc) public static int signatureLength(String sig, int pos)(Code)(Java Doc) public static int signatureLength(String sig)(Code)(Java Doc) public static String signatureToName(String sig)(Code)(Java Doc) public static PrimType signatureToPrimitive(char sig)(Code)(Java Doc) public static Type signatureToType(String sig, int off, int len)(Code)(Java Doc) public static Type signatureToType(String sig)(Code)(Java Doc) protected static int swappedCompareResult(int code)(Code)(Java Doc) public String toString()(Code)(Java Doc)
|
|
|