Class DexConstantLibrary

java.lang.Object
com.pnfsoftware.jeb.core.units.code.android.DexConstantLibrary

@Ser public class DexConstantLibrary extends Object
A manager for constant and pseudo-constant fields of a dex unit.
  • Constructor Details

    • DexConstantLibrary

      public DexConstantLibrary(IDexUnit dex)
  • Method Details

    • setValue

      public boolean setValue(Object value, int fieldIndex)
      Record a field constant (for an internal static final field) or a pseudo constant (attached to an external field reference).
      Parameters:
      value - a non-null value (must be a byte, char, short, int, long, float or double)
      fieldIndex - a field index, which can be:
      - a static final field index initialized to the provided value (note that the dex unit is responsible for setting those up; clients do not need to do that, unless a constant is to be forcefully changed to another value)
      - or any index to a pure field reference (external field) for whom a value is to be attached
      Returns:
      true if the value was recorded
    • getFieldIndices

      public Collection<Integer> getFieldIndices(Object value)
      Retrieve all fields with the provided value. Only the fields of the provided type are returned. Example: if value is an Integer, only I-type fields are returned. To retrieve a list of smaller- or bigger- type values, use getFieldIndices(Object, boolean, boolean).
      Parameters:
      value - a non-null value (must be a byte, char, short, int, long, float or double)
      Returns:
      a collection of dex field indices, possibly empty
    • getFieldIndices

      public Collection<Integer> getFieldIndices(Object value, boolean alsoGetSmaller, boolean alsoGetBigger)
      Retrieve all fields with the provided value.
      Parameters:
      value - a non-null value (must be a byte, char, short, int, long, float or double)
      alsoGetSmaller - if true, smaller-type values are returned
      alsoGetBigger - if true, bigger-type values are returned
      Returns:
      a collection of dex field indices, possibly empty