Interface ClassOutput

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ClassOutput
A container for created classes with a specific output strategy.
  • Method Details

    • write

      default void write(ClassDesc desc, byte[] bytes)
      Accept and write the class bytes.
      Parameters:
      desc - the class descriptor (not null)
      bytes - the class file bytes (not null)
    • registerBootstrapMethod

      default void registerBootstrapMethod(ClassDesc owner, String name, MethodTypeDesc type)
      Register a newly created bootstrap method. This can be used to register the method with a native image generator such as GraalVM. The first three argument types of the method type descriptor must be: Furthermore, if the method is a for an invokedynamic bootstrap, its return type must be ConstantDescs.CD_CallSite. The default implementation does nothing.
      Parameters:
      owner - the owner of the bootstrap method (must not be null)
      name - the bootstrap method name (must not be null)
      type - the bootstrap method type (must not be null)
    • write

      void write(String path, byte[] bytes)
      Write a resource to the output.
      Parameters:
      path - the resource relative path (not null)
      bytes - the resource bytes (not null)
    • andThen

      default ClassOutput andThen(ClassOutput next)
      Returns a class output that write the class bytes to this output as well as the given one.
      Parameters:
      next - the other class output to write to (must not be null)
      Returns:
      a class output that write the class bytes to this output as well as the given one
    • fileWriter

      static ClassOutput fileWriter(Path basePath)
      Returns a class output for the given path.
      Parameters:
      basePath - the path into which class files should be stored (must not be null)
      Returns:
      a class output for the given path
    • discarding

      static ClassOutput discarding()
      Returns a class output that discards its inputs.
      Returns:
      a class output that discards its inputs