Class EncodedField

java.lang.Object
com.android.dx.dex.file.EncodedMember
com.android.dx.dex.file.EncodedField
All Implemented Interfaces:
ToHuman, Comparable<EncodedField>

public final class EncodedField extends EncodedMember implements Comparable<EncodedField>
Representation of a field of a class, of any sort.
  • Constructor Details

    • EncodedField

      public EncodedField(CstFieldRef field, int accessFlags)
      Constructs an instance.
      Parameters:
      field - non-null; constant for the field
      accessFlags - access flags
  • Method Details

    • hashCode

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

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(EncodedField other)

      Note: This compares the method constants only, ignoring any associated code, because it should never be the case that two different items with the same method constant ever appear in the same list (or same file, even).

      Specified by:
      compareTo in interface Comparable<EncodedField>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addContents

      public void addContents(DexFile file)
      Populates a DexFile with items from within this instance.
      Specified by:
      addContents in class EncodedMember
      Parameters:
      file - non-null; the file to populate
    • getName

      public CstString getName()
      Gets the name.
      Specified by:
      getName in class EncodedMember
      Returns:
      non-null; the name
    • toHuman

      public String toHuman()
      Return the "human" string form of this instance. This is generally less "debuggy" than toString().
      Specified by:
      toHuman in interface ToHuman
      Returns:
      non-null; the human string form
    • debugPrint

      public void debugPrint(PrintWriter out, boolean verbose)
      Does a human-friendly dump of this instance.
      Specified by:
      debugPrint in class EncodedMember
      Parameters:
      out - non-null; where to dump
      verbose - whether to be verbose with the output
    • getRef

      public CstFieldRef getRef()
      Gets the constant for the field.
      Returns:
      non-null; the constant
    • encode

      public int encode(DexFile file, AnnotatedOutput out, int lastIndex, int dumpSeq)
      Encodes this instance to the given output.
      Specified by:
      encode in class EncodedMember
      Parameters:
      file - non-null; file this instance is part of
      out - non-null; where to write to
      lastIndex - >= 0; the previous member index value encoded, or 0 if this is the first element to encode
      dumpSeq - >= 0; sequence number of this instance for annotation purposes
      Returns:
      >= 0; the member index value that was encoded