Class SightlyCompiler
- java.lang.Object
-
- org.apache.sling.scripting.sightly.compiler.SightlyCompiler
-
public final class SightlyCompiler extends java.lang.ObjectThe
SightlyCompilerinterprets a HTL script and transforms it internally into aCommandStream. TheCommandStreamcan be fed to aBackendCompilerfor transforming the stream into executable code, either by transpiling the commands to a JVM supported language or by directly executing them.
-
-
Constructor Summary
Constructors Constructor Description SightlyCompiler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompilationResultcompile(CompilationUnit compilationUnit)Compiles aCompilationUnit.CompilationResultcompile(CompilationUnit compilationUnit, BackendCompiler backendCompiler)static SightlyCompilerwithKnownExpressionOptions(@NotNull java.util.Set<java.lang.String> options)Returns an instance of theSightlyCompilerwith the providedoptionsadded to the list of known expression options.
-
-
-
Method Detail
-
withKnownExpressionOptions
public static SightlyCompiler withKnownExpressionOptions(@NotNull @NotNull java.util.Set<java.lang.String> options)
Returns an instance of the
SightlyCompilerwith the providedoptionsadded to the list of known expression options.The compiler builds internally a set of allowed options from the options permitted by the expressions or plugins. As soon as an expression contains an unknown option the compiler logs a warning. Since the compiler works with dynamically registered
RuntimeCalls, some of them can work with additional expression options, not known to the compiler.NOTE: The
data-sly-template, data-sly-call, data-sly-useplugins allow arbitrary options which define parameters and do not generate warnings.- Parameters:
options- the options to add to the compiler's set of known expression options- Returns:
- an instance of the compiler
-
compile
public CompilationResult compile(CompilationUnit compilationUnit)
Compiles aCompilationUnit.- Parameters:
compilationUnit- a compilation unit- Returns:
- the compilation result
-
compile
public CompilationResult compile(CompilationUnit compilationUnit, BackendCompiler backendCompiler)
- Parameters:
compilationUnit- a compilation unitbackendCompiler- the backend compiler- Returns:
- the compilation result
-
-