Class ConduitContext

java.lang.Object
org.geysermc.conduit.ConduitContext

public class ConduitContext extends Object
The set of jars Conduit reads from.

Jars added with addJar(Path) are scanned. Context jars, added with addContextJar(Path), are only read. They let the scanner resolve classes and follow calls into a library without reporting the library's own calls.

ConduitContext context = ConduitContext.load(Path.of("mod.jar"));
context.addContextJar(Path.of("library.jar"));
  • Method Details

    • addJar

      public void addJar(@NotNull @NotNull Path jarPath)
      Adds a jar to scan.
      Parameters:
      jarPath - the jar
    • addJar

      public void addJar(URL @NotNull ... jarUrl)
      Adds jars to scan.
      Parameters:
      jarUrl - the jars
    • addContextJar

      public void addContextJar(@NotNull @NotNull Path jarPath)
      Adds a jar to read classes from without scanning it.
      Parameters:
      jarPath - the jar
    • addNestedJars

      public void addNestedJars(@NotNull @NotNull Path outerJar, @NotNull @NotNull String innerPath)
      Adds every jar directly inside a directory of another jar, such as META-INF/jars, to scan. Nested directories are not searched.
      Parameters:
      outerJar - the jar containing the others
      innerPath - the directory inside it
    • scanClasses

      public List<VirtualClass> scanClasses(@NotNull @NotNull ClassFilter filter)
      Lists every class in the context matching a filter, read from the class files alone.
      Parameters:
      filter - the filter
      Returns:
      the matching classes
    • classLoader

      public ConduitClassLoader classLoader()
      The loader over every jar in the context, used to read class files. Loading a class through it does not run the scanner.
      Returns:
      the loader over every jar in the context
    • load

      public static ConduitContext load(Path @NotNull ... jarPath)
      Creates a context that scans the given jars.
      Parameters:
      jarPath - the jars to scan
      Returns:
      a new context
    • load

      public static ConduitContext load(URL @NotNull ... jarUrl)
      Creates a context that scans the given jars.
      Parameters:
      jarUrl - the jars to scan
      Returns:
      a new context