Class Boxpiler

java.lang.Object
ortus.boxlang.compiler.Boxpiler
All Implemented Interfaces:
IBoxpiler
Direct Known Subclasses:
ASMBoxpiler, JavaBoxpiler

public abstract class Boxpiler extends Object implements IBoxpiler
  • Field Details

    • logger

      protected static final org.slf4j.Logger logger
      Logger
    • classPool

      protected Map<String,ClassInfo> classPool
      Keeps track of the classes we've compiled
    • frTransService

      protected FRTransService frTransService
      The transaction service used to track subtransactions
    • diskClassUtil

      protected DiskClassUtil diskClassUtil
      The disk class util
    • classGenerationDirectory

      protected Path classGenerationDirectory
      The directory where the generated classes are stored
  • Constructor Details

    • Boxpiler

      public Boxpiler()
  • Method Details

    • getClassPool

      public Map<String,ClassInfo> getClassPool()
      -------------------------------------------------------------------------- Public Methods --------------------------------------------------------------------------
      Specified by:
      getClassPool in interface IBoxpiler
    • parse

      public ParsingResult parse(String source, BoxSourceType type, Boolean classOrInterface)
      Parse source text into BoxLang AST nodes. This method will NOT throw an exception if the parse fails.
      Specified by:
      parse in interface IBoxpiler
      Parameters:
      source - The source to parse.
      type - The BoxSourceType of the source.
      Returns:
      The parsed AST nodes and any issues if encountered while parsing.
    • parseOrFail

      public ParsingResult parseOrFail(File file)
      Parse a file on disk into BoxLang AST nodes. This method will throw an exception if the parse fails.
      Specified by:
      parseOrFail in interface IBoxpiler
      Parameters:
      file - The file to parse
      Returns:
      The parsed AST nodes and any issues if encountered while parsing.
    • parse

      public ParsingResult parse(File file)
      Parse a file on disk into BoxLang AST nodes. This method will NOT throw an exception if the parse fails.
      Specified by:
      parse in interface IBoxpiler
      Parameters:
      file - The file to parse
      Returns:
      The parsed AST nodes and any issues if encountered while parsing.
    • parseOrFail

      public ParsingResult parseOrFail(String source, BoxSourceType type, Boolean classOrInterface)
      Parse source text into BoxLang AST nodes. This method will throw an exception if the parse fails.
      Specified by:
      parseOrFail in interface IBoxpiler
      Parameters:
      source - The source to parse.
      type - The BoxSourceType of the source.
      Returns:
      The parsed AST nodes and any issues if encountered while parsing.
    • validateParse

      public ParsingResult validateParse(ParsingResult result, String source)
      Validate a parsing result and throw an exception if the parse failed.
      Specified by:
      validateParse in interface IBoxpiler
      Parameters:
      result - The parsing result to validate
      Returns:
      The parsing result if the parse was successful
    • compileStatement

      public Class<IBoxRunnable> compileStatement(String source, BoxSourceType type)
      Compile a single BoxLang statement into a Java class
      Specified by:
      compileStatement in interface IBoxpiler
      Parameters:
      source - The BoxLang source code as a string
      type - The type of BoxLang source code
      Returns:
      The loaded class
    • compileScript

      public Class<IBoxRunnable> compileScript(String source, BoxSourceType type)
      Compile a BoxLang script into a Java class
      Specified by:
      compileScript in interface IBoxpiler
      Parameters:
      source - The BoxLang source code as a string
      type - The type of BoxLang source code
      Returns:
      The loaded class
    • compileTemplate

      public Class<IBoxRunnable> compileTemplate(ResolvedFilePath resolvedFilePath)
      Compile a BoxLang template (file on disk) into a Java class
      Specified by:
      compileTemplate in interface IBoxpiler
      Parameters:
      resolvedFilePath - The BoxLang source code as a Path on disk
      Returns:
      The loaded class
    • compileClass

      public Class<IBoxRunnable> compileClass(String source, BoxSourceType type)
      Compile a BoxLang Class from source into a Java class
      Specified by:
      compileClass in interface IBoxpiler
      Parameters:
      source - The BoxLang source code as a string
      Returns:
      The loaded class
    • compileClass

      public Class<IBoxRunnable> compileClass(ResolvedFilePath resolvedFilePath)
      Compile a BoxLang Class from a file into a Java class
      Specified by:
      compileClass in interface IBoxpiler
      Parameters:
      resolvedFilePath - The BoxLang source code as a Path on disk
      Returns:
      The loaded class
    • compileInterfaceProxy

      public Class<IProxyRunnable> compileInterfaceProxy(IBoxContext context, InterfaceProxyDefinition definition)
      Specified by:
      compileInterfaceProxy in interface IBoxpiler
    • getSourceMapFromFQN

      public SourceMap getSourceMapFromFQN(String FQN)
      Specified by:
      getSourceMapFromFQN in interface IBoxpiler