public class ClassFile extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ClassFile.Field |
static class |
ClassFile.Method |
static class |
ClassFile.Parameter |
| Modifier and Type | Field and Description |
|---|---|
protected ArrayList<BytecodeAttribute> |
attributes |
protected ArrayList<ClassFile.Field> |
fields |
protected List<JvmType.Clazz> |
interfaces |
protected ArrayList<ClassFile.Method> |
methods |
protected List<Modifier> |
modifiers |
protected JvmType.Clazz |
superClazz |
protected JvmType.Clazz |
type |
protected int |
version |
| Constructor and Description |
|---|
ClassFile(int version,
JvmType.Clazz type,
JvmType.Clazz superClazz,
List<JvmType.Clazz> interfaces,
List<Modifier> modifiers,
BytecodeAttribute... attributes) |
ClassFile(int version,
JvmType.Clazz type,
JvmType.Clazz superClazz,
List<JvmType.Clazz> interfaces,
List<Modifier> modifiers,
Collection<BytecodeAttribute> attributes) |
| Modifier and Type | Method and Description |
|---|---|
BytecodeAttribute |
attribute(String name) |
List<BytecodeAttribute> |
attributes() |
ArrayList<Constant.Info> |
constantPool()
This method builds a constant pool for this class file.
|
static String |
descriptor(JvmType t,
boolean generic)
This method returns a JVM descriptor string for the type in question.
|
ClassFile.Field |
field(String name) |
List<ClassFile.Field> |
fields() |
boolean |
hasModifier(Class modifierClass)
Check whether this method has one of the "base" modifiers (e.g.
|
List<JvmType.Clazz> |
inners() |
List<JvmType.Clazz> |
interfaces() |
boolean |
isAbstract()
Check whether this class is abstract
|
boolean |
isFinal()
Check whether this class is final
|
boolean |
isInnerClass()
Check whether or not this is an inner class.
|
boolean |
isInterface()
Check whether this class is abstract
|
boolean |
isNative()
Check whether this class is native
|
boolean |
isPrivate()
Check whether this class is private
|
boolean |
isProtected()
Check whether this class is protected
|
boolean |
isPublic()
Check whether this class is public
|
boolean |
isStatic()
Check whether this class is static
|
boolean |
isSynchronized()
Check whether this class is synchronized
|
boolean |
isSynthetic()
Check whether this class is synthetic
|
List<ClassFile.Method> |
methods() |
List<ClassFile.Method> |
methods(String name) |
List<Modifier> |
modifiers() |
String |
name() |
void |
setType(JvmType.Clazz t) |
static int |
slotSize(JvmType type)
Determine the slot size for the corresponding Java type.
|
JvmType.Clazz |
superClass() |
JvmType.Clazz |
type() |
int |
version() |
protected int version
protected JvmType.Clazz type
protected JvmType.Clazz superClazz
protected List<JvmType.Clazz> interfaces
protected ArrayList<BytecodeAttribute> attributes
protected ArrayList<ClassFile.Field> fields
protected ArrayList<ClassFile.Method> methods
public ClassFile(int version,
JvmType.Clazz type,
JvmType.Clazz superClazz,
List<JvmType.Clazz> interfaces,
List<Modifier> modifiers,
BytecodeAttribute... attributes)
public ClassFile(int version,
JvmType.Clazz type,
JvmType.Clazz superClazz,
List<JvmType.Clazz> interfaces,
List<Modifier> modifiers,
Collection<BytecodeAttribute> attributes)
public JvmType.Clazz type()
public String name()
public JvmType.Clazz superClass()
public List<JvmType.Clazz> interfaces()
public List<JvmType.Clazz> inners()
public List<BytecodeAttribute> attributes()
public BytecodeAttribute attribute(String name)
public List<ClassFile.Field> fields()
public ClassFile.Field field(String name)
public List<ClassFile.Method> methods()
public List<ClassFile.Method> methods(String name)
public int version()
public boolean hasModifier(Class modifierClass)
modifierClass - public boolean isInterface()
public boolean isAbstract()
public boolean isFinal()
public boolean isStatic()
public boolean isPublic()
public boolean isProtected()
public boolean isPrivate()
public boolean isNative()
public boolean isSynchronized()
public boolean isSynthetic()
public boolean isInnerClass()
public void setType(JvmType.Clazz t)
public ArrayList<Constant.Info> constantPool()
public static String descriptor(JvmType t, boolean generic)
| Type | Descriptor |
| int | I |
| boolean | Z |
| float[] | F[ |
| java.lang.Integer | Ljava/lang/Integer; |
| int(Double,Float) | (DF)I |
The descriptor string is used, amongst other things, to uniquely identify a class in the ClassTable.
See the JVM Specification for more information.t - The type to generate the descriptor forgeneric - True indicates generic information should be included.public static int slotSize(JvmType type)
type - The type to determine the slot size for.Copyright © 2016. All rights reserved.