Class ReferenceCollector


  • public class ReferenceCollector
    extends java.lang.Object
    LinkedHashMap is used for reference map to guarantee a deterministic order of iteration, so that bytecode generated based on it would also be deterministic.

    This class is only called at compile time by the MuzzleCodeGenerationPlugin ByteBuddy plugin.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void collectReferencesFromAdvice​(java.lang.String adviceClassName)
      Traverse a graph of classes starting from adviceClassName and collect all references to both internal (instrumentation) and external classes.
      void collectReferencesFromResource​(java.lang.String resource)
      If passed resource path points to an SPI file (either Java ServiceLoader or AWS SDK ExecutionInterceptor) reads the file and adds every implementation as a reference, traversing the graph of classes until a non-instrumentation (external) class is encountered.
      java.util.Map<java.lang.String,​Reference> getReferences()  
      java.util.List<java.lang.String> getSortedHelperClasses()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReferenceCollector

        public ReferenceCollector()
    • Method Detail

      • collectReferencesFromResource

        public void collectReferencesFromResource​(java.lang.String resource)
        If passed resource path points to an SPI file (either Java ServiceLoader or AWS SDK ExecutionInterceptor) reads the file and adds every implementation as a reference, traversing the graph of classes until a non-instrumentation (external) class is encountered.
        Parameters:
        resource - path to the resource file, same as in ClassLoader.getResource(String)
        See Also:
        InstrumentationClassPredicate
      • collectReferencesFromAdvice

        public void collectReferencesFromAdvice​(java.lang.String adviceClassName)
        Traverse a graph of classes starting from adviceClassName and collect all references to both internal (instrumentation) and external classes.

        The graph of classes is traversed until a non-instrumentation (external) class is encountered.

        Parameters:
        adviceClassName - Starting point for generating references.
        See Also:
        InstrumentationClassPredicate
      • getReferences

        public java.util.Map<java.lang.String,​Reference> getReferences()
      • getSortedHelperClasses

        public java.util.List<java.lang.String> getSortedHelperClasses()