Class JavaTranspiler
java.lang.Object
ortus.boxlang.compiler.javaboxpiler.Transpiler
ortus.boxlang.compiler.javaboxpiler.JavaTranspiler
- All Implemented Interfaces:
ITranspiler
BoxLang AST to Java AST transpiler
The registry maps a AST node to the corresponding Transformer Java class instance.
Each transformer implements the logic to convert the BoxLang AST nodes into Java
AST nodes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompileJava(com.github.javaparser.ast.CompilationUnit cu, String outputPath, List<String> classPath) Write a class bytecodecom.github.javaparser.ast.expr.ExpressioncreateAbstractMethod(BoxFunctionDeclaration bfd, AbstractTransformer transformer, String sourceObjectName, String sourceObjectType) List<com.github.javaparser.ast.CompilationUnit> Get the list of compilation units that represent the callable functionsList<com.github.javaparser.ast.stmt.Statement> List<com.github.javaparser.ast.stmt.Statement> Get the list of static UDF declarations that will get hoisted to the topGet the list of compilation units that represent the callable functionsList<com.github.javaparser.ast.stmt.Statement> Get the list of UDF declarations that will get hoisted to the topcom.github.javaparser.ast.Nodetransform(BoxNode node, TransformerContext context) Utility method to transform a node with a transformation contextTranspile a BoxLang AST into a Java Parser ASTMethods inherited from class ortus.boxlang.compiler.javaboxpiler.Transpiler
addImport, addJImport, addStaticInitializer, canReturn, escapeJavaString, getComponentCounter, getDateTime, getJImports, getKeys, getProperty, getResolvedFilePath, getStaticInitializers, getTranspiler, incrementAndGetClosureCounter, incrementAndGetComponentOptionalCounter, incrementAndGetForInCounter, incrementAndGetForLoopBreakCounter, incrementAndGetLambdaContextCounter, incrementAndGetLambdaCounter, incrementAndGetSwitchCounter, incrementAndGetTryCatchCounter, isInsideComponent, matchesImport, peekContextName, peekForLoopBreakCounter, popComponent, popContextName, popForLoopBreakCounter, popfunctionBodyCounter, pushComponent, pushContextName, pushfunctionBodyCounter, registerKey, run, setComponentCounter, setProperty, transform
-
Constructor Details
-
JavaTranspiler
public JavaTranspiler()
-
-
Method Details
-
transform
public com.github.javaparser.ast.Node transform(BoxNode node, TransformerContext context) throws IllegalStateException Utility method to transform a node with a transformation context- Specified by:
transformin classTranspiler- Parameters:
node- a BoxLang AST Nodecontext- transformation context- Returns:
- Throws:
IllegalStateException- See Also:
-
getStatements
-
compileJava
public String compileJava(com.github.javaparser.ast.CompilationUnit cu, String outputPath, List<String> classPath) throws IllegalStateException Write a class bytecode- Parameters:
cu- java compilation unitoutputPath- output directoryclassPath- classpath- Throws:
IllegalStateException- in the compilation fails
-
transpile
Transpile a BoxLang AST into a Java Parser AST- Specified by:
transpilein interfaceITranspiler- Specified by:
transpilein classTranspiler- Returns:
- a Java Parser TranspiledCode representing the equivalent Java code
- Throws:
IllegalStateExceptionBoxRuntimeException- See Also:
-
getCallables
Get the list of compilation units that represent the callable functions- Returns:
- the list of compilation units
-
getUDFcallables
Get the list of compilation units that represent the callable functions- Returns:
- the list of compilation units
-
getUDFDeclarations
Get the list of UDF declarations that will get hoisted to the top- Returns:
- the UDF declarations
-
getStaticUDFDeclarations
Get the list of static UDF declarations that will get hoisted to the top- Returns:
- the UDF declarations
-
createAbstractMethod
public com.github.javaparser.ast.expr.Expression createAbstractMethod(BoxFunctionDeclaration bfd, AbstractTransformer transformer, String sourceObjectName, String sourceObjectType)
-