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
ConstructorDescriptionDefaultExpressionEvaluationContext
(@Nullable Object thisObject, @Nullable Object[] args, @Nullable BeanContext beanContext, @Nullable BeanDefinition<?> owningBean) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getArgument
(int index) Provides method argument by index.<T> T
Provides 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, wait
Methods inherited from interface io.micronaut.context.expressions.ConfigurableExpressionEvaluationContext
withArguments
-
Constructor Details
-
DefaultExpressionEvaluationContext
public DefaultExpressionEvaluationContext() -
DefaultExpressionEvaluationContext
-
-
Method Details
-
withArguments
Description copied from interface:ConfigurableExpressionEvaluationContext
Set arguments passed to invoked method.- Specified by:
withArguments
in 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:ConfigurableExpressionEvaluationContext
Set bean owning evaluated expression.- Specified by:
withOwningBean
in interfaceConfigurableExpressionEvaluationContext
- Parameters:
beanDefinition
- owning bean definition- Returns:
- evaluation context aware of owning bean.
-
withBeanContext
Description copied from interface:ConfigurableExpressionEvaluationContext
Set context in which expression is evaluated.- Specified by:
withBeanContext
in interfaceConfigurableExpressionEvaluationContext
- Parameters:
beanContext
- bean context- Returns:
- evaluation context aware of bean context.
-
getThis
Description copied from interface:ExpressionEvaluationContext
Expressions that are evaluated in non-static contexts can reference "this".The object returned here is a reference to this.
- Specified by:
getThis
in interfaceExpressionEvaluationContext
- Returns:
- The object that represents this.
-
getArgument
Description copied from interface:ExpressionEvaluationContext
Provides method argument by index.- Specified by:
getArgument
in interfaceExpressionEvaluationContext
- Parameters:
index
- argument index- Returns:
- argument value
-
getProperty
Description copied from interface:ExpressionEvaluationContext
Provides property by name.- Specified by:
getProperty
in interfaceExpressionEvaluationContext
- Parameters:
name
- property name- Returns:
- property value or null
-
getBean
Description copied from interface:ExpressionEvaluationContext
Provides bean by type.- Specified by:
getBean
in interfaceExpressionEvaluationContext
- Type Parameters:
T
- type of required bean- Parameters:
type
- required bean class object- Returns:
- bean instance
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-