Class JavaBoxpiler

java.lang.Object
ortus.boxlang.compiler.Boxpiler
ortus.boxlang.compiler.javaboxpiler.JavaBoxpiler
All Implemented Interfaces:
IBoxpiler

public class JavaBoxpiler extends Boxpiler
This class uses the Java compiler to turn a BoxLang script into a Java class
  • Constructor Details

    • JavaBoxpiler

      public JavaBoxpiler()
      Private constructor
  • Method Details

    • getName

      public Key getName()
      Description copied from interface: IBoxpiler
      Gets the unique name identifier for this Boxpiler implementation. This is used by the runtime to distinguish between different compiler implementations (e.g., ASM-based compiler vs. Java source compiler).
      Returns:
      A Key representing the compiler's unique name
    • printTranspiledCode

      public void printTranspiledCode(ParsingResult result, ClassInfo classInfo, PrintStream target)
      Description copied from interface: IBoxpiler
      Prints the transpiled Java source code for debugging purposes. This method is useful for inspecting the generated Java code that results from compiling BoxLang source, particularly for troubleshooting compilation issues.
      Parameters:
      result - The parsing result containing the AST
      classInfo - The class information containing the transpiled code
      target - The PrintStream to write the transpiled code to (e.g., System.out)
    • generateJavaSource

      public String generateJavaSource(BoxNode node, ClassInfo classInfo)
      Generate Java source code from BoxLang AST nodes
      Parameters:
      node - The BoxLang root AST node
      classInfo - The class info object for this class
      Returns:
      The generated Java source code as a string
    • compileClassInfo

      public List<byte[]> compileClassInfo(String classPoolName, String FQN)
      Description copied from interface: IBoxpiler
      Compiles a class from the class pool into bytecode without loading it. This method retrieves a previously parsed class from the specified class pool and generates its bytecode for storage or transmission.
      Parameters:
      classPoolName - The name of the class pool containing the class
      FQN - The fully qualified name of the class to compile
      Returns:
      A list of byte arrays representing the compiled class and any inner classes