Package serp.bytecode.lowlevel
Class ClassEntry
- java.lang.Object
-
- serp.bytecode.lowlevel.Entry
-
- serp.bytecode.lowlevel.ClassEntry
-
- All Implemented Interfaces:
ConstantEntry
,VisitAcceptor
public class ClassEntry extends Entry implements ConstantEntry
A constant pool entry describing a class. Class entries are used to refer to the current class, the superclass, implemented interfaces, etc. Each class entry contains the constant pool index of theUTF8Entry
that stores the class name, which is represented in internal form.
-
-
Field Summary
Fields Modifier and Type Field Description private int
_nameIndex
-
Fields inherited from class serp.bytecode.lowlevel.Entry
CLASS, DOUBLE, FIELD, FLOAT, INT, INTERFACEMETHOD, INVOKEDYNAMIC, LONG, METHOD, METHODHANDLE, METHODTYPE, NAMEANDTYPE, STRING, UTF8
-
-
Constructor Summary
Constructors Constructor Description ClassEntry()
Default constructor.ClassEntry(int nameIndex)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptVisit(BCVisitor visit)
Accept a visit from aBCVisitor
, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.java.lang.Object
getConstant()
Return the value of the constant held by this entry.UTF8Entry
getNameEntry()
Return the referencedUTF8Entry
.int
getNameIndex()
Return the constant pool index of theUTF8Entry
containing the class name.int
getType()
Return the type code for this entry type.(package private) void
readData(java.io.DataInput in)
This method is called after reading the entry type from bytecode.void
setConstant(java.lang.Object value)
Set the value of the constant held by this entry.void
setNameIndex(int nameIndex)
Set the constant pool index of theUTF8Entry
containing the class name.(package private) void
writeData(java.io.DataOutput out)
This method is called after writing the entry type to bytecode.
-
-
-
Constructor Detail
-
ClassEntry
public ClassEntry()
Default constructor.
-
ClassEntry
public ClassEntry(int nameIndex)
Constructor.- Parameters:
nameIndex
- the constant pool index of theUTF8Entry
containing the class name
-
-
Method Detail
-
getNameIndex
public int getNameIndex()
Return the constant pool index of theUTF8Entry
containing the class name. Defaults to 0.
-
setNameIndex
public void setNameIndex(int nameIndex)
Set the constant pool index of theUTF8Entry
containing the class name.
-
getNameEntry
public UTF8Entry getNameEntry()
Return the referencedUTF8Entry
. This method can only be run for entries that have been added to a constant pool.
-
getType
public int getType()
Description copied from class:Entry
Return the type code for this entry type.
-
getConstant
public java.lang.Object getConstant()
Description copied from interface:ConstantEntry
Return the value of the constant held by this entry.- Specified by:
getConstant
in interfaceConstantEntry
-
setConstant
public void setConstant(java.lang.Object value)
Description copied from interface:ConstantEntry
Set the value of the constant held by this entry.- Specified by:
setConstant
in interfaceConstantEntry
-
acceptVisit
public void acceptVisit(BCVisitor visit)
Description copied from interface:VisitAcceptor
Accept a visit from aBCVisitor
, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.- Specified by:
acceptVisit
in interfaceVisitAcceptor
-
readData
void readData(java.io.DataInput in) throws java.io.IOException
Description copied from class:Entry
This method is called after reading the entry type from bytecode. It should read all the data for this entry from the given stream.
-
writeData
void writeData(java.io.DataOutput out) throws java.io.IOException
Description copied from class:Entry
This method is called after writing the entry type to bytecode. It should write all data for this entry to the given stream.
-
-