Package io.micronaut.expressions.context
Class DefaultExpressionCompilationContextFactory
java.lang.Object
io.micronaut.expressions.context.DefaultExpressionCompilationContextFactory
- All Implemented Interfaces:
ExpressionCompilationContextFactory
@Internal
public final class DefaultExpressionCompilationContextFactory
extends Object
implements ExpressionCompilationContextFactory
Factory for producing expression evaluation context.
- Since:
- 4.0.0
- Author:
- Sergey Gavrilov
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildContext
(EvaluatedExpressionReference expression, ClassElement thisElement) Builds expression evaluation context for expression reference.buildContextForMethod
(@NonNull EvaluatedExpressionReference expression, @NonNull MethodElement methodElement) Builds expression evaluation context for method.registerContextClass
(ClassElement contextClass) Adds evaluated expression context class element to context loader at compilation time.static void
reset()
cleanup any stored contexts.
-
Constructor Details
-
DefaultExpressionCompilationContextFactory
-
-
Method Details
-
buildContextForMethod
@NonNull public @NonNull ExpressionCompilationContext buildContextForMethod(@NonNull @NonNull EvaluatedExpressionReference expression, @NonNull @NonNull MethodElement methodElement) Description copied from interface:ExpressionCompilationContextFactory
Builds expression evaluation context for method. Expression evaluation context for method allows referencing method parameter names in evaluated expressions.- Specified by:
buildContextForMethod
in interfaceExpressionCompilationContextFactory
- Parameters:
expression
- expression referencemethodElement
- annotated method- Returns:
- evaluation context for method
-
buildContext
@NonNull public @NonNull ExpressionCompilationContext buildContext(EvaluatedExpressionReference expression, ClassElement thisElement) Description copied from interface:ExpressionCompilationContextFactory
Builds expression evaluation context for expression reference.- Specified by:
buildContext
in interfaceExpressionCompilationContextFactory
- Parameters:
expression
- expression reference- Returns:
- evaluation context for method
-
registerContextClass
Description copied from interface:ExpressionCompilationContextFactory
Adds evaluated expression context class element to context loader at compilation time.This method should be invoked from the
TypeElementVisitor.start(VisitorContext)
of aTypeElementVisitor
- Specified by:
registerContextClass
in interfaceExpressionCompilationContextFactory
- Parameters:
contextClass
- context class element- Returns:
- This context factory
-
reset
cleanup any stored contexts.
-