|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gnu.bytecode.Type gnu.bytecode.ObjectType gnu.bytecode.ClassType
public class ClassType
Field Summary | |
---|---|
int |
access_flags
|
Method |
constructor
|
static int |
major_version
|
static int |
minor_version
|
static ClassType[] |
noClasses
|
Fields inherited from class gnu.bytecode.ObjectType |
---|
flags |
Fields inherited from class gnu.bytecode.Type |
---|
boolean_ctype, boolean_type, booleanValue_method, byte_type, char_type, double_type, doubleValue_method, float_type, floatValue_method, int_type, intValue_method, java_lang_Class_type, long_type, longValue_method, neverReturnsType, nullType, number_type, pointer_type, reflectClass, short_type, string_type, throwable_type, toString_method, tostring_type, typeArray0, void_type |
Constructor Summary | |
---|---|
ClassType()
|
|
ClassType(java.lang.String class_name)
|
Method Summary | |
---|---|
Field |
addField()
Add a new field to this class. |
Field |
addField(java.lang.String name)
Add a new field to this class, and name the field. |
Field |
addField(java.lang.String name,
Type type)
|
Field |
addField(java.lang.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(java.lang.String name)
|
Method |
addMethod(java.lang.String name,
int flags)
|
Method |
addMethod(java.lang.String name,
int flags,
Type[] arg_types,
Type return_type)
Add a method to this ClassType. |
Method |
addMethod(java.lang.String name,
java.lang.String signature,
int flags)
|
Method |
addMethod(java.lang.String name,
Type[] arg_types,
Type return_type,
int flags)
|
void |
addMethods(java.lang.Class clas)
Use reflection to add all the declared methods of this class. |
int |
compare(Type other)
Return a numeric code showing "subtype" relationship: 1: if other is a pure subtype of this; 0: if has the same values; -1: if this is a pure subtype of other; -2: if they have values in common but neither is a subtype of the other; -3: if the types have no values in common. |
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()
Get the (first) Attribute of this container. |
CpoolEntry |
getConstant(int i)
|
ConstantPool |
getConstants()
|
Field |
getDeclaredField(java.lang.String name)
Find a field with the given name declared in this class. |
Method |
getDeclaredMethod(java.lang.String name,
int argCount)
Get a method with matching name and number of arguments. |
Method |
getDeclaredMethod(java.lang.String name,
Type[] arg_types)
|
Method |
getDeclaredMethods()
|
Field |
getField(java.lang.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(java.lang.String name,
Type[] paramTypes,
int flags)
|
Method |
getMethod(java.lang.reflect.Method method)
Add a method to this ClassType. |
Method |
getMethod(java.lang.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)
Deprecated. |
int |
getMethods(Filter filter,
int searchSupers,
java.util.Vector result,
java.lang.String context)
Helper to get methods satisfying a filtering predicate. |
int |
getModifiers()
Return the modifiers (access flags) for this class. |
java.lang.String |
getPackageName()
|
ClassType |
getSuperclass()
|
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(ClassType other)
|
static ClassType |
make(java.lang.String name)
Find a ClassType with the given name, or create a new one. |
static ClassType |
make(java.lang.String name,
ClassType superClass)
|
void |
readExternal(java.io.ObjectInput in)
|
java.lang.Object |
readResolve()
|
void |
setAttributes(Attribute attributes)
Set the (list of) Attributes of this container. |
void |
setInterface(boolean val)
|
void |
setInterfaces(ClassType[] interfaces)
|
void |
setModifiers(int flags)
Set the modifiers (access flags) for this class. |
void |
setName(java.lang.String name)
Sets the name of the class being defined in this classfile. |
void |
setSourceFile(java.lang.String name)
Set the name of the SourceFile associated with this class. |
void |
setStratum(java.lang.String stratum)
Create a SourceDebugExtAttr , if needed, and
set the "stratum". |
void |
setSuper(ClassType superClass)
|
void |
setSuper(java.lang.String name)
Set the superclass of the is class. |
static byte[] |
to_utf8(java.lang.String str)
Convert a String to a Utf8 byte array. |
java.lang.String |
toString()
|
void |
writeExternal(java.io.ObjectOutput out)
|
byte[] |
writeToArray()
|
void |
writeToFile()
|
void |
writeToFile(java.lang.String filename)
|
void |
writeToStream(java.io.OutputStream stream)
|
Methods inherited from class gnu.bytecode.ObjectType |
---|
coerceFromObject, emitCoerceFromObject, getImplementationType, getInternalName, getReflectClass, isExisting, promote, setExisting |
Methods inherited from class gnu.bytecode.Type |
---|
coerceToObject, emitCoerceToObject, emitIsInstance, getName, getSignature, getSize, getType, hashCode, isInstance, isMoreSpecific, isSubtype, isValidJavaTypeName, isVoid, lookupType, lowestCommonSuperType, make, registerTypeForClass, setReflectClass, setSignature, signatureLength, signatureLength, signatureToName, signatureToPrimitive, signatureToType, signatureToType, swappedCompareResult |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int minor_version
public static final int major_version
public int access_flags
public static final ClassType[] noClasses
public Method constructor
Constructor Detail |
---|
public ClassType()
public ClassType(java.lang.String class_name)
Method Detail |
---|
public static ClassType make(java.lang.String name)
name
- the name of the class (e..g. "java.lang.String").public static ClassType make(java.lang.String name, ClassType superClass)
public final Attribute getAttributes()
AttrContainer
getAttributes
in interface AttrContainer
public final void setAttributes(Attribute attributes)
AttrContainer
setAttributes
in interface AttrContainer
public final ConstantPool getConstants()
public final CpoolEntry getConstant(int i)
public final int getModifiers()
public final void setModifiers(int flags)
public boolean isAccessible(ClassType declaring, int modifiers)
declaring
- the class containing the component (a field, method,
or inner class)modifiers
- the access flags of the component
public void setName(java.lang.String name)
setName
in class Type
name
- the name to give to the classpublic void setStratum(java.lang.String stratum)
SourceDebugExtAttr
, if needed, and
set the "stratum". The stratum is typically a programming language
such as "JSP", "Scheme", or "Java" (the default).
public void setSourceFile(java.lang.String name)
public void setSuper(java.lang.String name)
name
- name of super class, or null if this is "Object".public void setSuper(ClassType superClass)
public ClassType getSuperclass()
public java.lang.String getPackageName()
public ClassType[] getInterfaces()
public void setInterfaces(ClassType[] interfaces)
public void addInterface(ClassType newInterface)
public final boolean isInterface()
public final void setInterface(boolean val)
public final Field getFields()
public final int getFieldCount()
public Field getDeclaredField(java.lang.String name)
public Field getField(java.lang.String name)
public Field addField()
public Field addField(java.lang.String name)
name
- the name of the new fieldpublic final Field addField(java.lang.String name, Type type)
public final Field addField(java.lang.String name, Type type, int flags)
public void addFields()
public final Method getMethods()
public final int getMethodCount()
public Method addMethod(java.lang.String name)
public Method addMethod(java.lang.String name, int flags)
public Method addMethod(java.lang.String name, Type[] arg_types, Type return_type, int flags)
public Method addMethod(java.lang.String name, int flags, Type[] arg_types, Type return_type)
public Method addMethod(java.lang.String name, java.lang.String signature, int flags)
public Method getMethod(java.lang.reflect.Method method)
public final Method getDeclaredMethods()
public final int countMethods(Filter filter, int searchSupers)
filter
- to select methods to returnsearchSupers
- 0 if only current class should be searched,
1 if superclasses should also be searched,
2 if super-interfaces should also be search
public Method[] getMethods(Filter filter, boolean searchSupers)
public Method[] getMethods(Filter filter, int searchSupers)
filter
- to select methods to returnsearchSupers
- 0 if only current class should be searched,
1 if superclasses should also be searched,
2 if super-interfaces should also be searched
public int getMethods(Filter filter, int searchSupers, Method[] result, int offset)
filter
- to select methods to returnsearchSupers
- 0 if only current class should be searched,
1 if superclasses should also be searched,
2 if super-interfaces should also be searchresult
- array to place selected methods inoffset
- start of where in result to place result
public int getMethods(Filter filter, int searchSupers, java.util.Vector result, java.lang.String context)
filter
- to select methods to returnsearchSupers
- 0 if only current class should be searched,
1 if superclasses should also be searched,
2 if super-interfaces should also be searchresult
- Vector to add selected methods incontext
- If non-null, skip if class not visible in named package.
public Method getDeclaredMethod(java.lang.String name, Type[] arg_types)
public Method getDeclaredMethod(java.lang.String name, int argCount)
public Method getMethod(java.lang.String name, Type[] arg_types)
public void addMethods(java.lang.Class clas)
clas
- should be the same as getReflectClass().public Method[] getMatchingMethods(java.lang.String name, Type[] paramTypes, int flags)
public void doFixups()
public void writeToStream(java.io.OutputStream stream) throws java.io.IOException
java.io.IOException
public void writeToFile(java.lang.String filename) throws java.io.IOException
java.io.IOException
public void writeToFile() throws java.io.IOException
java.io.IOException
public byte[] writeToArray()
public static byte[] to_utf8(java.lang.String str)
str
- the input String.
public final boolean implementsInterface(ClassType iface)
public final boolean isSubclass(ClassType other)
public int compare(Type other)
Type
compare
in class ObjectType
public java.lang.String toString()
toString
in class Type
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public java.lang.Object readResolve() throws java.io.ObjectStreamException
java.io.ObjectStreamException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |