Package io.micronaut.context.expressions
Class DefaultExpressionEvaluationContext
java.lang.Object
io.micronaut.context.expressions.DefaultExpressionEvaluationContext
- All Implemented Interfaces:
ConfigurableExpressionEvaluationContext,ExpressionEvaluationContext,AutoCloseable
@Internal
public final class DefaultExpressionEvaluationContext
extends Object
implements ConfigurableExpressionEvaluationContext
Default implementation of
ConfigurableExpressionEvaluationContext.
For this implementation, the methods mutating evaluation context return new instance of
expression evaluation context.- Since:
- 4.0.0
- Author:
- Sergey Gavrilov
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultExpressionEvaluationContext(@Nullable Object thisObject, @Nullable Object[] args, @Nullable BeanContext beanContext, @Nullable BeanDefinition<?> owningBean) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getArgument(int index) Provides method argument by index.<T> TProvides bean by type.getProperty(String name) Provides property by name.getThis()Expressions that are evaluated in non-static contexts can reference "this".withArguments(Object thisObject, Object[] args) Set arguments passed to invoked method.withBeanContext(BeanContext beanContext) Set context in which expression is evaluated.withOwningBean(BeanDefinition<?> beanDefinition) Set bean owning evaluated expression.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.context.expressions.ConfigurableExpressionEvaluationContext
withArguments
-
Constructor Details
-
DefaultExpressionEvaluationContext
public DefaultExpressionEvaluationContext() -
DefaultExpressionEvaluationContext
-
-
Method Details
-
withArguments
Description copied from interface:ConfigurableExpressionEvaluationContextSet arguments passed to invoked method.- Specified by:
withArgumentsin interfaceConfigurableExpressionEvaluationContext- Parameters:
thisObject- In the case of non-static methods the object that represents this objectargs- method arguments- Returns:
- evaluation context which arguments can be used in evaluation.
-
withOwningBean
Description copied from interface:ConfigurableExpressionEvaluationContextSet bean owning evaluated expression.- Specified by:
withOwningBeanin interfaceConfigurableExpressionEvaluationContext- Parameters:
beanDefinition- owning bean definition- Returns:
- evaluation context aware of owning bean.
-
withBeanContext
Description copied from interface:ConfigurableExpressionEvaluationContextSet context in which expression is evaluated.- Specified by:
withBeanContextin interfaceConfigurableExpressionEvaluationContext- Parameters:
beanContext- bean context- Returns:
- evaluation context aware of bean context.
-
getThis
Description copied from interface:ExpressionEvaluationContextExpressions that are evaluated in non-static contexts can reference "this".The object returned here is a reference to this.
- Specified by:
getThisin interfaceExpressionEvaluationContext- Returns:
- The object that represents this.
-
getArgument
Description copied from interface:ExpressionEvaluationContextProvides method argument by index.- Specified by:
getArgumentin interfaceExpressionEvaluationContext- Parameters:
index- argument index- Returns:
- argument value
-
getProperty
Description copied from interface:ExpressionEvaluationContextProvides property by name.- Specified by:
getPropertyin interfaceExpressionEvaluationContext- Parameters:
name- property name- Returns:
- property value or null
-
getBean
Description copied from interface:ExpressionEvaluationContextProvides bean by type.- Specified by:
getBeanin interfaceExpressionEvaluationContext- Type Parameters:
T- type of required bean- Parameters:
type- required bean class object- Returns:
- bean instance
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-