Class StringConstant

All Implemented Interfaces:
Serializable, Processable

public class StringConstant extends Constant
This Constant represents a string constant in the constant pool.
See Also:
  • Field Details

    • u2stringIndex

      public int u2stringIndex
    • referencedClass

      public 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. This field is typically filled out by the DynamicClassReferenceInitializer or by the DynamicMemberReferenceInitializer.
    • referencedMember

      public Member referencedMember
      An extra field pointing to the referenced Member object, if this string is being used in Class.getDeclaredField/Method constructs. This field is typically filled out by the DynamicMemberReferenceInitializer.
    • javaLangStringClass

      public Clazz javaLangStringClass
      An extra field pointing to the java.lang.String Clazz object. This field is typically filled out by the ClassReferenceInitializer..
    • referencedResourceId

      public int referencedResourceId
      An extra field pointing to the referenced resource ID, if this string references an Android resource. Limitation: a String may point to multiple resources with the same name but a different type - only one can be cached.
    • referencedResourceFile

      public ResourceFile referencedResourceFile
      An extra field pointing to the referenced resource file, if this string references one.
  • Constructor Details

    • StringConstant

      public StringConstant()
      Creates an uninitialized StringConstant.
    • StringConstant

      public StringConstant(int u2stringIndex, Clazz referencedClass, Member referencedMember)
      Creates a new StringConstant with the given string index.
      Parameters:
      u2stringIndex - the index of the string in the constant pool.
      referencedClass - the referenced class, if any.
      referencedMember - the referenced class member, if any.
    • StringConstant

      public StringConstant(int u2stringIndex, ResourceFile referencedResourceFile)
      Creates a new StringConstant with the given string index.
      Parameters:
      u2stringIndex - the index of the string in the constant pool.
      referencedResourceFile - the referenced resource filename, if any.
    • StringConstant

      public StringConstant(int u2stringIndex, Clazz referencedClass, Member referencedMember, int referencedResourceId, ResourceFile referencedResourceFile)
      Creates a new StringConstant with the given string index.
      Parameters:
      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.
  • Method Details

    • getString

      public String getString(Clazz clazz)
      Returns the string value.
    • getTag

      public int getTag()
      Description copied from class: Constant
      Returns the constant pool info tag that specifies the entry type.
      Specified by:
      getTag in class Constant
    • isCategory2

      public boolean isCategory2()
      Description copied from class: Constant
      Returns whether the constant is of category 2. This means that it takes up the space of two category 1 types in the constant pool or on the stack, for instance.
      Specified by:
      isCategory2 in class Constant
    • accept

      public void accept(Clazz clazz, ConstantVisitor constantVisitor)
      Description copied from class: Constant
      Accepts the given visitor.
      Specified by:
      accept in class Constant
    • referencedClassAccept

      public void referencedClassAccept(ClassVisitor classVisitor)
      Lets the referenced class accept the given visitor.
    • referencedMemberAccept

      public void referencedMemberAccept(MemberVisitor memberVisitor)
      Lets the referenced member accept the given visitor.
    • referencedResourceFileAccept

      public void referencedResourceFileAccept(ResourceFileVisitor resourceFileVisitor)
      Lets the referenced resource file accept the given visitor.
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object