Interface StartupConfig


public interface StartupConfig
This interface must be implemented by your application hook. It is used to identify JAR files that will (potentially) be loaded into the process
  • Method Summary

    Modifier and Type
    Method
    Description
    default List<URL>
    This should return a List of URLs to be included in a "fake" classpath.
    This should return a JarFiles object that you have populated with whatever Jar files you wish to be processed for injection and interception.
    This function should return the entrypoint to execute after all interception and class modification has completed.
    default Set<String>
    This function should return a set of fully-qualified class names that will have their fields and methods made public.
    default boolean
    This function should return true if, after examining the string parameter, you wish to have that particular class made public.
  • Method Details

    • getJarFilesToInject

      JarFiles getJarFilesToInject()
      This should return a JarFiles object that you have populated with whatever Jar files you wish to be processed for injection and interception.
      Returns:
      the JarFiles to be processed.
    • getClasspaths

      default List<URL> getClasspaths()
      This should return a List of URLs to be included in a "fake" classpath. By default, this is just whatever Jar files you've listed in getJarFilesToInject() but if you have other dependencies (whether jar files, or just a directory of .class files) that, for whatever reason, are not known to the JVM via the -cp argument, list them here.
      Returns:
      a list of URLs to be used for the "fake" classpath.
    • getRealMain

      Consumer<String[]> getRealMain()
      This function should return the entrypoint to execute after all interception and class modification has completed. In most cases, you can likely write your method as simply as return TheClass::main
      Returns:
      The true main() function of the intercepted application
    • makePublic

      default Set<String> makePublic()

      This function should return a set of fully-qualified class names that will have their fields and methods made public. Note that since Java loads sub-classes as their own file, you should add references to those separately too - e.g. Class$SubClass

      To have any effect, the class must not have been loaded yet.

      The default interface method returns an empty set and does nothing.

      Returns:
      A Set of fully-qualified class names to make public.
    • shouldMakePublic

      default boolean shouldMakePublic(String cls)

      This function should return true if, after examining the string parameter, you wish to have that particular class made public. This is a complimentary option to makePublic() - either of these two can be used to make a class public.

      This is called whenever a class is loaded.

      The default interface method returns an empty set and does nothing.

      Parameters:
      cls - The fully-qualified class name - e.g. foo.bar.MyClass
      Returns:
      A Set of fully-qualified class names to make public.