Package ortus.boxlang.runtime.types
Class DynamicFunction
java.lang.Object
ortus.boxlang.runtime.types.Function
ortus.boxlang.runtime.types.UDF
ortus.boxlang.runtime.types.DynamicFunction
- All Implemented Interfaces:
Serializable,IBoxRunnable,IFunctionRunnable,IType
This represents a BoxLang Function that will be created dynamically either by Java or BoxLang.
It can be used to generate using a Java Lambda, or subclass with no compiling or parsing.
The impetus of this class is to be able to have an injected mixin that can pivot according to
the name of the function as it's injected into a BoxLang class.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ortus.boxlang.runtime.types.Function
Function.Access -
Field Summary
Fields inherited from class ortus.boxlang.runtime.types.Function
$bx, ARGUMENT_COLLECTION, interceptorService -
Constructor Summary
ConstructorsConstructorDescriptionDynamicFunction(Key name, BiFunction<FunctionBoxContext, DynamicFunction, Object> target) Simple Constructor of just the name and the targetDynamicFunction(Key name, BiFunction<FunctionBoxContext, DynamicFunction, Object> target, String returnType) Simple Constructor of just the name, target, and return typeDynamicFunction(Key name, BiFunction<FunctionBoxContext, DynamicFunction, Object> target, Argument[] arguments) Simple Constructor of just the name and the target and argumentsDynamicFunction(Key name, BiFunction<FunctionBoxContext, DynamicFunction, Object> target, Argument[] arguments, String returnType, String hint, IStruct annotations) Full Constructor -
Method Summary
Modifier and TypeMethodDescription_invoke(FunctionBoxContext context) This is our proxy to the lambda we generate the function withAll dynamic functions are usually publicGet any annotations declared for this function, both the @annotation syntax and inline.Argument[]Get the arguments of the function.Get the contents of the documentation comment for this function.The imports for this runnablegetName()Get the name of the function.Get the return type of the function.The AST (abstract syntax tree) of the runnableGet the date the template was compiledlongGet the version of the BoxLang runtimeThe path to the templateThe original source typeMethods inherited from class ortus.boxlang.runtime.types.Function
asString, canOutput, createArgumentsScope, createArgumentsScope, createArgumentsScope, ensureReturnType, generateFunctionContext, generateFunctionContext, getBoxMeta, getDefaultOutput, getEnclosingClass, getMetaData, getModifiers, hasModifier, implementsSignature, invoke, requiresStrictArguments, signatureAsStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ortus.boxlang.runtime.types.IType
computeHashCode
-
Constructor Details
-
DynamicFunction
public DynamicFunction(Key name, BiFunction<FunctionBoxContext, DynamicFunction, Object> target, Argument[] arguments, String returnType, String hint, IStruct annotations) Full Constructor- Parameters:
name- The name of the function that will be used to register itarguments- The arguments of the functionreturnType- The return type of the functionhint- The hint of the functionannotations- The annotations of the function
-
DynamicFunction
public DynamicFunction(Key name, BiFunction<FunctionBoxContext, DynamicFunction, Object> target, Argument[] arguments) Simple Constructor of just the name and the target and arguments- Parameters:
name- The name of the function that will be used to register ittarget- The target lambda that will be executed when the function is calledarguments- The arguments of the function
-
DynamicFunction
Simple Constructor of just the name and the target- Parameters:
name- The name of the function that will be used to register ittarget- The target lambda that will be executed when the function is called
-
DynamicFunction
public DynamicFunction(Key name, BiFunction<FunctionBoxContext, DynamicFunction, Object> target, String returnType) Simple Constructor of just the name, target, and return type- Parameters:
name- The name of the function that will be used to register ittarget- The target lambda that will be executed when the function is calledreturnType- The return type of the function
-
-
Method Details
-
_invoke
This is our proxy to the lambda we generate the function with -
getName
Description copied from class:FunctionGet the name of the function. -
getArguments
Description copied from class:FunctionGet the arguments of the function.- Specified by:
getArgumentsin classFunction- Returns:
- array of arguments
-
getImports
Description copied from interface:IBoxRunnableThe imports for this runnable -
getRunnablePath
Description copied from interface:IBoxRunnableThe path to the template -
getSourceType
Description copied from interface:IBoxRunnableThe original source type -
getReturnType
Description copied from class:FunctionGet the return type of the function.- Specified by:
getReturnTypein classFunction- Returns:
- return type
-
getAnnotations
Description copied from class:FunctionGet any annotations declared for this function, both the @annotation syntax and inline.- Specified by:
getAnnotationsin classFunction- Returns:
- function metadata
-
getDocumentation
Description copied from class:FunctionGet the contents of the documentation comment for this function.- Specified by:
getDocumentationin classFunction- Returns:
- function metadata
-
getAccess
All dynamic functions are usually public -
getRunnableCompileVersion
public long getRunnableCompileVersion()Description copied from class:FunctionGet the version of the BoxLang runtime- Specified by:
getRunnableCompileVersionin interfaceIBoxRunnable- Specified by:
getRunnableCompileVersionin classFunction
-
getRunnableCompiledOn
Description copied from class:FunctionGet the date the template was compiled- Specified by:
getRunnableCompiledOnin interfaceIBoxRunnable- Specified by:
getRunnableCompiledOnin classFunction
-
getRunnableAST
Description copied from class:FunctionThe AST (abstract syntax tree) of the runnable- Specified by:
getRunnableASTin interfaceIBoxRunnable- Specified by:
getRunnableASTin classFunction
-