Class DexReferences


  • public class DexReferences
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      DexReferences​(org.jf.dexlib2.dexbacked.DexBackedDexFile[] files)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addReferencesForNode​(DexElementNode node, boolean shallow)
      Finds references to referenced and attaches them as tree nodes under node
      DexElementNode getReferenceTreeFor​(org.jf.dexlib2.iface.reference.Reference referenced)
      Build a full reference tree for the given DEX reference.
      DexElementNode getReferenceTreeFor​(org.jf.dexlib2.iface.reference.Reference referenced, boolean shallow)
      Build a reference tree for the given DEX reference.
      static boolean isAlreadyLoaded​(DexElementNode node)
      Checks if the specified dex reference tree node has had its references evaluated and attached (if any) or if it still needs to be passed to #addReferencesForNode(DexElementNode, Reference, boolean) for lazy evaluation
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NODE_COMPARATOR

        public static final java.util.Comparator<DexElementNode> NODE_COMPARATOR
    • Constructor Detail

      • DexReferences

        public DexReferences​(org.jf.dexlib2.dexbacked.DexBackedDexFile[] files)
    • Method Detail

      • getReferenceTreeFor

        public DexElementNode getReferenceTreeFor​(@NonNull
                                                  org.jf.dexlib2.iface.reference.Reference referenced)
        Build a full reference tree for the given DEX reference.
        Parameters:
        referenced - the dex element you wish to find references for
        Returns:
        the root of the reference tree
      • getReferenceTreeFor

        public DexElementNode getReferenceTreeFor​(@NonNull
                                                  org.jf.dexlib2.iface.reference.Reference referenced,
                                                  boolean shallow)
        Build a reference tree for the given DEX reference. Depending on the shallow parameter this returns the full tree root or just the root with first level references evaluated.

        You can then lazy load deeper references using #addReferencesForNode(DexElementNode node, Reference referenced, boolean shallow).

        To check if references were already loaded for a node use isAlreadyLoaded(DexElementNode)

        Parameters:
        referenced - the dex element you wish to find references for
        shallow - false to to build the full tree, true to evaluate just the first level
        Returns:
        the root of the reference tree
      • addReferencesForNode

        public void addReferencesForNode​(@NonNull
                                         DexElementNode node,
                                         boolean shallow)
        Finds references to referenced and attaches them as tree nodes under node

        Depending on the shallow parameter this attaches the full reference tree or stops evaluation at the first level

        Parameters:
        node - the root node under which you wish to attach references
        shallow - false to to build the full tree, true to evaluate just the first level
      • isAlreadyLoaded

        public static boolean isAlreadyLoaded​(DexElementNode node)
        Checks if the specified dex reference tree node has had its references evaluated and attached (if any) or if it still needs to be passed to #addReferencesForNode(DexElementNode, Reference, boolean) for lazy evaluation
        Parameters:
        node - the reference tree node to check
        Returns:
        true if this node is already evaluated