Package serp.bytecode
Class State
- java.lang.Object
-
- serp.bytecode.State
-
- Direct Known Subclasses:
ArrayState
,ObjectState
,PrimitiveState
class State extends java.lang.Object
The State type is extended by various concrete types to change the behavior of aBCClass
. All methods in this base implementation throw anUnsupportedOperationException
-
-
Constructor Summary
Constructors Constructor Description State()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAccessFlags()
Return the access flags of the bytecode class.java.util.Collection
getAttributesHolder()
Return theAttribute
s of this class, or empty list if none.java.lang.String
getComponentName()
Return the name of the component type of this array, or null if not an array.java.util.List
getFieldsHolder()
Return theBCField
s of this class, or empty list if none.int
getIndex()
Return theConstantPool
index of theClassEntry
for this class, or 0 if none.java.util.List
getInterfacesHolder()
Return theConstantPool
indexes of theClassEntry
s for the indexes of this class, or empty list if none.int
getMagic()
Return the magic number of the bytecode class.int
getMajorVersion()
Return the major number of the bytecode class.java.util.List
getMethodsHolder()
Return theBCMethod
s of this class, or empty list if none.int
getMinorVersion()
Return the minor number of the bytecode class.java.lang.String
getName()
Return the name of the class.ConstantPool
getPool()
Return the constant pool of the class.int
getSuperclassIndex()
Return theConstantPool
index of theClassEntry
for the superclass of this class, or 0 if none.java.lang.String
getSuperclassName()
Return the name of the superclass.boolean
isArray()
Return true if this class is an array.boolean
isPrimitive()
Return true if this class is a primitive.void
setAccessFlags(int access)
Set the access flags of the bytecode class.void
setIndex(int index)
Set theConstantPool
index of theClassEntry
for this class.void
setMagic(int magic)
Set the magic number of the bytecode class.void
setMajorVersion(int major)
Set the major version of the bytecode class.void
setMinorVersion(int minor)
Set the minor version of the bytecode class.void
setSuperclassIndex(int index)
Set theConstantPool
index of theClassEntry
for the superclass of this class.
-
-
-
Field Detail
-
INVALID
public static final State INVALID
A singleton instance of this type that can be used to make a class invalid.
-
-
Method Detail
-
getMagic
public int getMagic()
Return the magic number of the bytecode class.
-
setMagic
public void setMagic(int magic)
Set the magic number of the bytecode class.
-
getMajorVersion
public int getMajorVersion()
Return the major number of the bytecode class.
-
setMajorVersion
public void setMajorVersion(int major)
Set the major version of the bytecode class.
-
getMinorVersion
public int getMinorVersion()
Return the minor number of the bytecode class.
-
setMinorVersion
public void setMinorVersion(int minor)
Set the minor version of the bytecode class.
-
getAccessFlags
public int getAccessFlags()
Return the access flags of the bytecode class.
-
setAccessFlags
public void setAccessFlags(int access)
Set the access flags of the bytecode class.
-
getIndex
public int getIndex()
Return theConstantPool
index of theClassEntry
for this class, or 0 if none.
-
setIndex
public void setIndex(int index)
Set theConstantPool
index of theClassEntry
for this class.
-
getSuperclassIndex
public int getSuperclassIndex()
Return theConstantPool
index of theClassEntry
for the superclass of this class, or 0 if none.
-
setSuperclassIndex
public void setSuperclassIndex(int index)
Set theConstantPool
index of theClassEntry
for the superclass of this class. ThrowsUnsupportedOperationException
by default.
-
getInterfacesHolder
public java.util.List getInterfacesHolder()
Return theConstantPool
indexes of theClassEntry
s for the indexes of this class, or empty list if none. If the state does not support changing the interfaces, the returned list should be immutable.
-
getFieldsHolder
public java.util.List getFieldsHolder()
Return theBCField
s of this class, or empty list if none. If the state does not support changing the fields, the returned list should be immutable.
-
getMethodsHolder
public java.util.List getMethodsHolder()
Return theBCMethod
s of this class, or empty list if none. If the state does not support changing the methods, the returned list should be immutable.
-
getAttributesHolder
public java.util.Collection getAttributesHolder()
Return theAttribute
s of this class, or empty list if none. If the state does not support changing the attributes, the returned list should be immutable.
-
getPool
public ConstantPool getPool()
Return the constant pool of the class.
-
getName
public java.lang.String getName()
Return the name of the class. The name should be in a form suitable for aClass.forName(java.lang.String)
call.
-
getSuperclassName
public java.lang.String getSuperclassName()
Return the name of the superclass. The name should be in a form suitable for aClass.forName(java.lang.String)
call, or null if none.
-
getComponentName
public java.lang.String getComponentName()
Return the name of the component type of this array, or null if not an array. The name should be in a form suitable for aClass.forName(java.lang.String)
call.
-
isPrimitive
public boolean isPrimitive()
Return true if this class is a primitive.
-
isArray
public boolean isArray()
Return true if this class is an array.
-
-