public class StringConstant extends Constant
Constant
represents a string constant in the constant pool.Modifier and Type | Field and Description |
---|---|
Clazz |
javaLangStringClass
An extra field pointing to the java.lang.String Clazz object.
|
Clazz |
referencedClass
An extra field pointing to the referenced Clazz object, if this string is being used in
Class.forName(), .class, or Class.getDeclaredField/Method constructs.
|
Member |
referencedMember
An extra field pointing to the referenced Member object, if this string is being used in
Class.getDeclaredField/Method constructs.
|
ResourceFile |
referencedResourceFile
An extra field pointing to the referenced resource file, if this string references one.
|
int |
referencedResourceId
An extra field pointing to the referenced resource ID, if this string references an Android
resource.
|
int |
u2stringIndex |
CLASS, DOUBLE, DYNAMIC, FIELDREF, FLOAT, INTEGER, INTERFACE_METHODREF, INVOKE_DYNAMIC, LONG, METHOD_HANDLE, METHOD_TYPE, METHODREF, MODULE, NAME_AND_TYPE, PACKAGE, PRIMITIVE_ARRAY, STRING, UTF8
processingFlags, processingInfo
Constructor and Description |
---|
StringConstant()
Creates an uninitialized StringConstant.
|
StringConstant(int u2stringIndex,
Clazz referencedClass,
Member referencedMember)
Creates a new StringConstant with the given string index.
|
StringConstant(int u2stringIndex,
Clazz referencedClass,
Member referencedMember,
int referencedResourceId,
ResourceFile referencedResourceFile)
Creates a new StringConstant with the given string index.
|
StringConstant(int u2stringIndex,
ResourceFile referencedResourceFile)
Creates a new StringConstant with the given string index.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(Clazz clazz,
ConstantVisitor constantVisitor)
Accepts the given visitor.
|
boolean |
equals(java.lang.Object object) |
java.lang.String |
getString(Clazz clazz)
Returns the string value.
|
int |
getTag()
Returns the constant pool info tag that specifies the entry type.
|
int |
hashCode() |
boolean |
isCategory2()
Returns whether the constant is of category 2.
|
void |
referencedClassAccept(ClassVisitor classVisitor)
Lets the referenced class accept the given visitor.
|
void |
referencedMemberAccept(MemberVisitor memberVisitor)
Lets the referenced member accept the given visitor.
|
void |
referencedResourceFileAccept(ResourceFileVisitor resourceFileVisitor)
Lets the referenced resource file accept the given visitor.
|
java.lang.String |
toString() |
addProcessingFlags, getProcessingFlags, getProcessingInfo, hasProcessingFlags, removeProcessingFlags, setProcessingFlags, setProcessingInfo
public int u2stringIndex
public Clazz referencedClass
DynamicClassReferenceInitializer
or by the DynamicMemberReferenceInitializer
.public Member referencedMember
DynamicMemberReferenceInitializer
.public Clazz javaLangStringClass
ClassReferenceInitializer
..public int referencedResourceId
public ResourceFile referencedResourceFile
public StringConstant()
public StringConstant(int u2stringIndex, Clazz referencedClass, Member referencedMember)
u2stringIndex
- the index of the string in the constant pool.referencedClass
- the referenced class, if any.referencedMember
- the referenced class member, if any.public StringConstant(int u2stringIndex, ResourceFile referencedResourceFile)
u2stringIndex
- the index of the string in the constant pool.referencedResourceFile
- the referenced resource filename, if any.public StringConstant(int u2stringIndex, Clazz referencedClass, Member referencedMember, int referencedResourceId, ResourceFile referencedResourceFile)
u2stringIndex
- the index of the string in the constant pool.referencedClass
- the referenced class, if any.referencedMember
- the referenced class member, if any.referencedResourceId
- the referenced resource id, if any, 0 otherwise.referencedResourceFile
- the referenced resource filename, if any.public java.lang.String getString(Clazz clazz)
public int getTag()
Constant
public boolean isCategory2()
Constant
isCategory2
in class Constant
public void accept(Clazz clazz, ConstantVisitor constantVisitor)
Constant
public void referencedClassAccept(ClassVisitor classVisitor)
public void referencedMemberAccept(MemberVisitor memberVisitor)
public void referencedResourceFileAccept(ResourceFileVisitor resourceFileVisitor)
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object