Package serp.bytecode
Class ConstantValue
java.lang.Object
serp.bytecode.Attributes
serp.bytecode.Attribute
serp.bytecode.ConstantValue
- All Implemented Interfaces:
BCEntity,VisitAcceptor
A constant value for a member field.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptVisit(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.doubleGet the value of this double constant.getField()Return the owning field.floatGet the value of this float constant.intGet the value of this int constant, or 0 if not set.(package private) intReturn the length of the bytecode representation of this attribute in bytes, excluding the name index.longGet the value of this long constant.Get the value of this string constant.getType()Return the type of constant this attribute represents (String.class, int.class, etc), or null if not set.Return the bytecode for the type of constant this attribute represents.Return the type of constant this attribute represents, or null if not set.getValue()Return the value of this constant as an Object of the appropriate type (String, Integer, Double, etc), or null if not set.intReturn theConstantPoolindex of theConstantEntryholding the value of this constant.(package private) voidRead the attribute bytecode from the given stream, up to length bytes, excluding the name index.(package private) voidCopy the information from the given attribute to this one.voidsetDoubleValue(double value) Set the value of this double constant.voidsetFloatValue(float value) Set the value of this float constant.voidsetIntValue(int value) Set the value of this int constant.voidsetLongValue(long value) Set the value of this long constant.voidsetStringValue(String value) Set the value of this string constant.voidSet the value of this constant using the appropriate wrapper Object type (String, Integer, Double, etc).voidsetValueIndex(int valueIndex) Set theConstantPoolof theConstantEntryholding the value of this constant.(package private) voidwrite(DataOutput out, int length) Write the attribute bytecode to the given stream, up to length bytes, excluding the name index.Methods inherited from class serp.bytecode.Attribute
create, getAttributesHolder, getClassLoader, getName, getNameIndex, getOwner, getPool, getProject, invalidate, isValidMethods inherited from class serp.bytecode.Attributes
addAttribute, addAttribute, clearAttributes, getAttribute, getAttributes, getAttributes, readAttributes, removeAttribute, removeAttribute, setAttributes, visitAttributes, writeAttributes
-
Field Details
-
_valueIndex
int _valueIndex
-
-
Constructor Details
-
ConstantValue
ConstantValue(int nameIndex, Attributes owner)
-
-
Method Details
-
getLength
int getLength()Description copied from class:AttributeReturn the length of the bytecode representation of this attribute in bytes, excluding the name index. -
getField
Return the owning field. -
getValueIndex
public int getValueIndex()Return theConstantPoolindex of theConstantEntryholding the value of this constant. Defaults to 0. -
setValueIndex
public void setValueIndex(int valueIndex) Set theConstantPoolof theConstantEntryholding the value of this constant. -
getTypeName
Return the type of constant this attribute represents, or null if not set. -
getType
Return the type of constant this attribute represents (String.class, int.class, etc), or null if not set. -
getTypeBC
Return the bytecode for the type of constant this attribute represents. -
getValue
Return the value of this constant as an Object of the appropriate type (String, Integer, Double, etc), or null if not set. -
setValue
Set the value of this constant using the appropriate wrapper Object type (String, Integer, Double, etc). Types that are not directly supported will be converted accordingly if possible. -
getIntValue
public int getIntValue()Get the value of this int constant, or 0 if not set. -
setIntValue
public void setIntValue(int value) Set the value of this int constant. -
getFloatValue
public float getFloatValue()Get the value of this float constant. -
setFloatValue
public void setFloatValue(float value) Set the value of this float constant. -
getDoubleValue
public double getDoubleValue()Get the value of this double constant. -
setDoubleValue
public void setDoubleValue(double value) Set the value of this double constant. -
getLongValue
public long getLongValue()Get the value of this long constant. -
setLongValue
public void setLongValue(long value) Set the value of this long constant. -
getStringValue
Get the value of this string constant. -
setStringValue
Set the value of this string constant. -
acceptVisit
Description copied from interface:VisitAcceptorAccept 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. -
read
Description copied from class:AttributeCopy the information from the given attribute to this one. Does nothing by default. -
read
Description copied from class:AttributeRead the attribute bytecode from the given stream, up to length bytes, excluding the name index. Does nothing by default.- Overrides:
readin classAttribute- Throws:
IOException
-
write
Description copied from class:AttributeWrite the attribute bytecode to the given stream, up to length bytes, excluding the name index. Does nothing by default.- Overrides:
writein classAttribute- Throws:
IOException
-