public class Express4Runner
extends java.lang.Object
| Constructor and Description |
|---|
Express4Runner(InitOptions initOptions) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addAlias(java.lang.String alias,
java.lang.String originToken)
add alias for keyWord, operator and function
|
boolean |
addCompileTimeFunction(java.lang.String name,
CompileTimeFunction compileTimeFunction)
add compile time function
|
void |
addExtendFunction(ExtensionFunction extensionFunction)
add extension function
|
void |
addExtendFunction(java.lang.String name,
java.lang.Class<?> bindingClass,
QLFunctionalVarargs functionalVarargs)
add an extension function with variable arguments.
|
<T> boolean |
addFunction(java.lang.String name,
java.util.function.Consumer<T> consumer) |
boolean |
addFunction(java.lang.String name,
CustomFunction function)
add user defined function to QLExpress engine
|
<T,R> boolean |
addFunction(java.lang.String name,
java.util.function.Function<T,R> function) |
<T> boolean |
addFunction(java.lang.String name,
java.util.function.Predicate<T> predicate) |
boolean |
addFunction(java.lang.String name,
java.lang.Runnable runnable) |
BatchAddFunctionResult |
addFunctionsDefinedInScript(java.lang.String scriptWithFunctionDefine,
ExpressContext context,
QLOptions qlOptions)
execute `scriptWithFunctionDefine` and add functions defined in script
|
boolean |
addMacro(java.lang.String name,
java.lang.String macroScript)
add user defined global macro to QLExpress engine
|
BatchAddFunctionResult |
addObjFunction(java.lang.Object object)
add object member method with annotation
QLFunction as function |
boolean |
addOperator(java.lang.String operator,
CustomBinaryOperator customBinaryOperator)
add operator with multi precedences
|
boolean |
addOperator(java.lang.String operator,
CustomBinaryOperator customBinaryOperator,
int precedence)
add operator
|
boolean |
addOperator(java.lang.String operator,
QLFunctionalVarargs functionalVarargs) |
<T,U,R> boolean |
addOperatorBiFunction(java.lang.String operator,
java.util.function.BiFunction<T,U,R> biFunction) |
void |
addOrReplaceMacro(java.lang.String name,
java.lang.String macroScript)
add or replace user defined global macro to QLExpress engine
|
BatchAddFunctionResult |
addStaticFunction(java.lang.Class<?> clazz)
add class static method with annotation
QLFunction as function |
boolean |
addVarArgsFunction(java.lang.String name,
QLFunctionalVarargs functionalVarargs) |
void |
check(java.lang.String script) |
void |
check(java.lang.String script,
CheckOptions checkOptions) |
void |
clearCompileCache()
Clear the compilation cache.
|
QLResult |
execute(java.lang.String script,
ExpressContext context,
QLOptions qlOptions) |
QLResult |
execute(java.lang.String script,
java.util.Map<java.lang.String,java.lang.Object> context,
QLOptions qlOptions)
Execute the script with variables set in the context; the map key corresponds to the
variable name referenced in the script.
|
QLResult |
execute(java.lang.String script,
java.lang.Object context,
QLOptions qlOptions)
Execute the script with variables resolved from the fields of the given context object.
|
QLResult |
executeTemplate(java.lang.String template,
java.util.Map<java.lang.String,java.lang.Object> context,
QLOptions qlOptions)
Execute a template string by wrapping it as a dynamic string literal.
|
QLResult |
executeWithAliasObjects(java.lang.String script,
QLOptions qlOptions,
java.lang.Object... objects)
Execute the script using objects annotated with
@QLAlias. |
CompileTimeFunction |
getCompileTimeFunction(java.lang.String functionName) |
java.util.List<TracePointTree> |
getExpressionTracePoints(java.lang.String script)
Get the expression trace trees for the script without executing it.
|
CustomFunction |
getFunction(java.lang.String functionName) |
java.util.Set<java.lang.String> |
getOutFunctions(java.lang.String script)
Get external functions (those that must be provided via context) referenced by the script.
|
java.util.Set<java.util.List<java.lang.String>> |
getOutVarAttrs(java.lang.String script)
Get external variable attribute access paths referenced by the script.
|
java.util.Set<java.lang.String> |
getOutVarNames(java.lang.String script)
Get external variables (those that must be provided via context) referenced by the script.
|
Value |
loadField(java.lang.Object object,
java.lang.String fieldName) |
QCompileCache |
parseToDefinitionWithCache(java.lang.String script)
parse script with cache
|
QLambdaTrace |
parseToLambda(java.lang.String script,
ExpressContext context,
QLOptions qlOptions) |
QLParser.ProgramContext |
parseToSyntaxTree(java.lang.String script) |
boolean |
replaceDefaultOperator(java.lang.String operator,
CustomBinaryOperator customBinaryOperator) |
public Express4Runner(InitOptions initOptions)
public CustomFunction getFunction(java.lang.String functionName)
public CompileTimeFunction getCompileTimeFunction(java.lang.String functionName)
public QLResult execute(java.lang.String script, java.util.Map<java.lang.String,java.lang.Object> context, QLOptions qlOptions) throws QLException
script - the script content to executecontext - variables for execution, keyed by variable nameqlOptions - execution options (e.g. interpolation, debug)QLException - if a script or runtime error occurspublic QLResult executeTemplate(java.lang.String template, java.util.Map<java.lang.String,java.lang.Object> context, QLOptions qlOptions) throws QLException
template - the template text to evaluate as a dynamic stringcontext - variables available to the templateqlOptions - execution optionsQLException - if compilation or execution failspublic QLResult execute(java.lang.String script, java.lang.Object context, QLOptions qlOptions) throws QLException
script - the script content to executecontext - the object whose public fields/properties are exposed as variablesqlOptions - execution optionsQLException - if a script or runtime error occurspublic QLResult executeWithAliasObjects(java.lang.String script, QLOptions qlOptions, java.lang.Object... objects)
@QLAlias.
The QLAlias.value serves as the variable name for each object.
Objects without the annotation are ignored.script - the script content to executeqlOptions - execution optionsobjects - objects annotated with @QLAliasQLException - if a script or runtime error occurspublic QLResult execute(java.lang.String script, ExpressContext context, QLOptions qlOptions)
public java.util.Set<java.lang.String> getOutVarNames(java.lang.String script)
script - the script contentpublic java.util.Set<java.util.List<java.lang.String>> getOutVarAttrs(java.lang.String script)
script - the script contentpublic java.util.Set<java.lang.String> getOutFunctions(java.lang.String script)
script - the script contentpublic java.util.List<TracePointTree> getExpressionTracePoints(java.lang.String script)
script - the script contentpublic boolean addMacro(java.lang.String name,
java.lang.String macroScript)
name - macro namemacroScript - script for macropublic void addOrReplaceMacro(java.lang.String name,
java.lang.String macroScript)
name - macro namemacroScript - script for macropublic boolean addFunction(java.lang.String name,
CustomFunction function)
name - function namefunction - function definitionpublic <T,R> boolean addFunction(java.lang.String name,
java.util.function.Function<T,R> function)
public boolean addVarArgsFunction(java.lang.String name,
QLFunctionalVarargs functionalVarargs)
public <T> boolean addFunction(java.lang.String name,
java.util.function.Predicate<T> predicate)
public boolean addFunction(java.lang.String name,
java.lang.Runnable runnable)
public <T> boolean addFunction(java.lang.String name,
java.util.function.Consumer<T> consumer)
public BatchAddFunctionResult addFunctionsDefinedInScript(java.lang.String scriptWithFunctionDefine, ExpressContext context, QLOptions qlOptions)
scriptWithFunctionDefine - script with function definecontext - context when execute scriptqlOptions - qlOptions when execute scriptpublic BatchAddFunctionResult addObjFunction(java.lang.Object object)
QLFunction as functionobject - object with member method with annotation QLFunctionpublic BatchAddFunctionResult addStaticFunction(java.lang.Class<?> clazz)
QLFunction as functionclazz - class with static method with annotation QLFunctionpublic boolean addCompileTimeFunction(java.lang.String name,
CompileTimeFunction compileTimeFunction)
name - function namecompileTimeFunction - definitionpublic void addExtendFunction(ExtensionFunction extensionFunction)
extensionFunction - definition of extansion functionpublic void addExtendFunction(java.lang.String name,
java.lang.Class<?> bindingClass,
QLFunctionalVarargs functionalVarargs)
name - the name of the extension functionbindingClass - the receiver type (class)functionalVarargs - custom logicpublic QLParser.ProgramContext parseToSyntaxTree(java.lang.String script)
public void check(java.lang.String script,
CheckOptions checkOptions)
throws QLSyntaxException
QLSyntaxExceptionpublic void check(java.lang.String script)
throws QLSyntaxException
QLSyntaxExceptionpublic QLambdaTrace parseToLambda(java.lang.String script, ExpressContext context, QLOptions qlOptions)
public QCompileCache parseToDefinitionWithCache(java.lang.String script)
script - script to parsepublic Value loadField(java.lang.Object object, java.lang.String fieldName)
public void clearCompileCache()
public <T,U,R> boolean addOperatorBiFunction(java.lang.String operator,
java.util.function.BiFunction<T,U,R> biFunction)
public boolean addOperator(java.lang.String operator,
QLFunctionalVarargs functionalVarargs)
public boolean addOperator(java.lang.String operator,
CustomBinaryOperator customBinaryOperator)
operator - operator namecustomBinaryOperator - operator implementpublic boolean addOperator(java.lang.String operator,
CustomBinaryOperator customBinaryOperator,
int precedence)
operator - operator namecustomBinaryOperator - operator implementprecedence - precedence, see QLPrecedencespublic boolean replaceDefaultOperator(java.lang.String operator,
CustomBinaryOperator customBinaryOperator)
operator - operator namecustomBinaryOperator - operator implementpublic boolean addAlias(java.lang.String alias,
java.lang.String originToken)
alias - must be a valid idoriginToken - key word in qlexpressCopyright © 2012-2025 Alibaba Group. All Rights Reserved.