Class ClassInterfaceDetector

java.lang.Object
rife.instrument.ClassInterfaceDetector
Direct Known Subclasses:
ContinuableDetector

public class ClassInterfaceDetector extends Object
Detects whether a class implements a particular interface by analyzing the bytecode instead of loading the class and performing reflection calls.
Since:
1.0
  • Constructor Details

    • ClassInterfaceDetector

      public ClassInterfaceDetector(ClassBytesProvider bytesProvider, String internalInterfaceNameInterned)
      Creates a new instance of the interface detector.
      Parameters:
      bytesProvider - the bytecode provider that will be used to load the bytes of the parent classes or interfaces
      internalInterfaceNameInterned - the name of the interface that should be detected, it should be in the internal bytecode naming format (/ instead of .) and it should be interned.
      Since:
      1.0
  • Method Details

    • detect

      public boolean detect(byte[] bytes, boolean doAutoReload) throws ClassNotFoundException
      Perform the detection.
      Parameters:
      bytes - the bytecode of the class that is being analyzed
      doAutoReload - indicator if the class should be automatically reloaded after a modification to the sources, in case the ClassBytesProvider supports this
      Returns:
      true if the detection was successful; or

      false otherwise

      Throws:
      ClassNotFoundException