Modifier and Type | Field and Description |
---|---|
static int |
ACC_FINAL |
static int |
ACC_PRIVATE |
static int |
ACC_PROTECTED |
static int |
ACC_PUBLIC |
static int |
ACC_STATIC |
static int |
ACC_SUPER |
static int |
MAGIC |
Constructor and Description |
---|
JavaClass() |
JavaClass(JavaClassLoader loader) |
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(Attribute attr)
Adds an attribute
|
void |
addField(JavaField field)
Adds a field
|
void |
addInterface(java.lang.String className)
Adds an interface.
|
void |
addMethod(JavaMethod method)
Adds a method
|
JavaField |
createField(java.lang.String name,
java.lang.String descriptor) |
JavaMethod |
createMethod(java.lang.String name,
java.lang.String descriptor) |
JavaMethod |
findMethod(java.lang.String name,
java.lang.String descriptor)
Finds a method.
|
int |
getAccessFlags()
Gets the access flags.
|
JAnnotation |
getAnnotation(java.lang.String className)
Returns the annotation.
|
Attribute |
getAttribute(java.lang.String name)
Returns the attribute.
|
java.util.ArrayList<Attribute> |
getAttributeList()
Returns the methods.
|
JavaClassLoader |
getClassLoader()
Returns the loader.
|
ConstantPool |
getConstantPool()
Returns the class's constant pool.
|
JMethod[] |
getConstructors()
Returns the array of declared methods.
|
JAnnotation[] |
getDeclaredAnnotations()
Returns the declared annotations.
|
JField[] |
getDeclaredFields()
Returns the array of declared fields.
|
JMethod[] |
getDeclaredMethods()
Returns the array of declared methods.
|
JavaField |
getField(java.lang.String name)
Returns a fields.
|
java.util.ArrayList<JavaField> |
getFieldList()
Returns the fields.
|
JField[] |
getFields()
Returns the array of fields.
|
java.util.ArrayList<java.lang.String> |
getInterfaceNames()
Adds an interface.
|
JClass[] |
getInterfaces()
Gets the interfaces.
|
int |
getMajor()
Gets the major identifier of the class file.
|
JavaMethod |
getMethod(java.lang.String name)
Returns a method.
|
JMethod |
getMethod(java.lang.String name,
JClass[] paramTypes)
Returns the matching method
|
java.util.ArrayList<JavaMethod> |
getMethodList()
Returns the methods.
|
JMethod[] |
getMethods()
Returns the matching method
|
int |
getMinor()
Gets the minor identifier of the class file.
|
java.lang.String |
getName()
Returns the class-equivalent name.
|
JClass |
getSuperClass()
Gets the super class name.
|
java.lang.String |
getSuperClassName()
Gets the super class name.
|
java.lang.String |
getThisClass()
Gets this class name.
|
boolean |
isAbstract()
Returns true for an abstract class.
|
boolean |
isArray()
Returns true for an array.
|
boolean |
isAssignableFrom(java.lang.Class cl)
Returns true if the class is assignable from the argument.
|
boolean |
isAssignableFrom(JClass cl)
Returns true if the class is assignable from the argument.
|
boolean |
isAssignableTo(java.lang.Class cl)
Returns true if the class is assignable from the argument.
|
boolean |
isFinal()
Returns true for a final class.
|
boolean |
isInterface()
Returns true for an interface.
|
boolean |
isPrimitive()
Returns true for a primitive class.
|
boolean |
isPublic()
Returns true for a public class.
|
void |
setAccessFlags(int flags)
Sets the access flags.
|
void |
setMajor(int major)
Sets the major identifier of the class file.
|
void |
setMinor(int minor)
Sets the minor identifier of the class file.
|
void |
setSuperClass(java.lang.String className)
Sets the super class.
|
void |
setThisClass(java.lang.String className)
Sets this class.
|
void |
setURL(java.net.URL url)
Sets the URL.
|
void |
setWrite(boolean isWrite) |
java.lang.String |
toString() |
void |
write(WriteStream os)
Writes the class to the output.
|
equals, getActualTypeArguments, getComponentType, getConstructor, getJavaClass, getPrintName, getRawType, getShortName, getSimpleName, hashCode
getAnnotation, isAnnotationPresent, isAnnotationPresent
public static final int MAGIC
public static final int ACC_PUBLIC
public static final int ACC_PRIVATE
public static final int ACC_PROTECTED
public static final int ACC_STATIC
public static final int ACC_FINAL
public static final int ACC_SUPER
public JavaClass()
public JavaClass(JavaClassLoader loader)
public JavaClassLoader getClassLoader()
public void setWrite(boolean isWrite)
public void setURL(java.net.URL url)
public void setMajor(int major)
public int getMajor()
public void setMinor(int minor)
public int getMinor()
public ConstantPool getConstantPool()
public void setAccessFlags(int flags)
public int getAccessFlags()
public void setThisClass(java.lang.String className)
public java.lang.String getThisClass()
public void setSuperClass(java.lang.String className)
public java.lang.String getSuperClassName()
public JClass getSuperClass()
getSuperClass
in interface JType
getSuperClass
in class JClass
public boolean isFinal()
public boolean isAbstract()
isAbstract
in interface JType
isAbstract
in class JClass
public boolean isPublic()
public boolean isPrimitive()
isPrimitive
in interface JType
isPrimitive
in class JClass
public void addInterface(java.lang.String className)
public java.util.ArrayList<java.lang.String> getInterfaceNames()
public JClass[] getInterfaces()
getInterfaces
in interface JType
getInterfaces
in class JClass
public void addField(JavaField field)
public JavaField createField(java.lang.String name, java.lang.String descriptor)
public java.util.ArrayList<JavaField> getFieldList()
public JavaField getField(java.lang.String name)
public void addMethod(JavaMethod method)
public JavaMethod createMethod(java.lang.String name, java.lang.String descriptor)
public java.util.ArrayList<JavaMethod> getMethodList()
public boolean isArray()
public boolean isInterface()
isInterface
in interface JType
isInterface
in class JClass
public JavaMethod getMethod(java.lang.String name)
public JavaMethod findMethod(java.lang.String name, java.lang.String descriptor)
public void addAttribute(Attribute attr)
public java.util.ArrayList<Attribute> getAttributeList()
public Attribute getAttribute(java.lang.String name)
public java.lang.String getName()
public boolean isAssignableFrom(JClass cl)
isAssignableFrom
in interface JType
isAssignableFrom
in class JClass
public boolean isAssignableFrom(java.lang.Class cl)
isAssignableFrom
in interface JType
isAssignableFrom
in class JClass
public boolean isAssignableTo(java.lang.Class cl)
isAssignableTo
in interface JType
isAssignableTo
in class JClass
public JMethod[] getDeclaredMethods()
getDeclaredMethods
in interface JType
getDeclaredMethods
in class JClass
public JMethod[] getConstructors()
getConstructors
in class JClass
public JMethod getMethod(java.lang.String name, JClass[] paramTypes)
public JMethod[] getMethods()
getMethods
in interface JType
getMethods
in class JClass
public JField[] getDeclaredFields()
getDeclaredFields
in interface JType
getDeclaredFields
in class JClass
public JField[] getFields()
public JAnnotation[] getDeclaredAnnotations()
getDeclaredAnnotations
in class JAnnotationObject
public JAnnotation getAnnotation(java.lang.String className)
getAnnotation
in class JAnnotationObject
public void write(WriteStream os) throws java.io.IOException
java.io.IOException