Package io.micronaut.context
Class AbstractExecutableMethodsDefinition<T>
java.lang.Object
io.micronaut.context.AbstractExecutableMethodsDefinition<T>
- Type Parameters:
T
- The type
- All Implemented Interfaces:
BeanContextConfigurable
,EnvironmentConfigurable
,ExecutableMethodsDefinition<T>
@Internal
public abstract class AbstractExecutableMethodsDefinition<T>
extends Object
implements ExecutableMethodsDefinition<T>, EnvironmentConfigurable, BeanContextConfigurable
Abstract base class for for
ExecutableMethodsDefinition
.- Since:
- 3.0
- Author:
- Denis Stepanov
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Internal class representing method's metadata. -
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractExecutableMethodsDefinition
(AbstractExecutableMethodsDefinition.MethodReference[] methodsReferences) -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(BeanContext beanContext) Configure the component for the given bean context.void
configure
(Environment environment) Configure the component for the given environment.protected Object
Triggers the invocation of the method at index.<R> Optional<ExecutableMethod<T,
R>> findMethod
(String name, Class<?>... argumentTypes) Finds a singleExecutableMethod
for the given name and argument types.<R> Stream<ExecutableMethod<T,
R>> findPossibleMethods
(String name) Finds possible methods for the given method name.protected final Method
getAccessibleTargetMethodByIndex
(int index) FindMethod
representation at the method by index.<R> ExecutableMethod<T,
R> getExecutableMethodByIndex
(int index) GetsExecutableMethod
method by it's index.protected <R> @Nullable ExecutableMethod<T,
R> Finds executable method or returns a null otherwise.protected abstract Method
getTargetMethodByIndex
(int index) FindMethod
representation at the method by index.protected final boolean
methodAtIndexMatches
(int index, String name, Class<?>[] argumentTypes) Checks if the method at index matches name and argument types.protected final RuntimeException
unknownDispatchAtIndexException
(int index) Creates a new exception when the dispatch at index is not found.protected final Throwable
unknownMethodAtIndexException
(int index) Creates a new exception when the method at index is not found.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.EnvironmentConfigurable
hasPropertyExpressions
-
Constructor Details
-
AbstractExecutableMethodsDefinition
protected AbstractExecutableMethodsDefinition(AbstractExecutableMethodsDefinition.MethodReference[] methodsReferences)
-
-
Method Details
-
configure
Description copied from interface:EnvironmentConfigurable
Configure the component for the given environment.- Specified by:
configure
in interfaceEnvironmentConfigurable
- Parameters:
environment
- The environment
-
configure
Description copied from interface:BeanContextConfigurable
Configure the component for the given bean context.- Specified by:
configure
in interfaceBeanContextConfigurable
- Parameters:
beanContext
- The bean context
-
getExecutableMethods
- Specified by:
getExecutableMethods
in interfaceExecutableMethodsDefinition<T>
- Returns:
- The
ExecutableMethod
instances for this definition
-
findMethod
Description copied from interface:ExecutableMethodsDefinition
Finds a singleExecutableMethod
for the given name and argument types.- Specified by:
findMethod
in interfaceExecutableMethodsDefinition<T>
- Type Parameters:
R
- The return type- Parameters:
name
- The method nameargumentTypes
- The argument types- Returns:
- An optional
ExecutableMethod
-
findPossibleMethods
Description copied from interface:ExecutableMethodsDefinition
Finds possible methods for the given method name.- Specified by:
findPossibleMethods
in interfaceExecutableMethodsDefinition<T>
- Type Parameters:
R
- The return type- Parameters:
name
- The method name- Returns:
- The possible methods
-
getExecutableMethodByIndex
GetsExecutableMethod
method by it's index.- Type Parameters:
R
- The result type- Parameters:
index
- The method index- Returns:
- The
ExecutableMethod
-
getMethod
@Nullable protected <R> @Nullable ExecutableMethod<T,R> getMethod(String name, Class<?>... argumentTypes) Finds executable method or returns a null otherwise.- Type Parameters:
R
- The return type- Parameters:
name
- The method nameargumentTypes
- The method arguments- Returns:
- The
ExecutableMethod
-
dispatch
Triggers the invocation of the method at index. Used byExecutable.invoke(Object, Object...)
.- Parameters:
index
- The method indextarget
- The targetargs
- The arguments- Returns:
- The result
-
getTargetMethodByIndex
FindMethod
representation at the method by index. Used byMethodReference.getTargetMethod()
.- Parameters:
index
- The index- Returns:
- The method
-
getAccessibleTargetMethodByIndex
FindMethod
representation at the method by index. Used byMethodReference.getTargetMethod()
.- Parameters:
index
- The index- Returns:
- The method
- Since:
- 3.4.0
-
unknownMethodAtIndexException
Creates a new exception when the method at index is not found.- Parameters:
index
- The method index- Returns:
- The exception
-
unknownDispatchAtIndexException
Creates a new exception when the dispatch at index is not found.- Parameters:
index
- The method index- Returns:
- The exception
-
methodAtIndexMatches
Checks if the method at index matches name and argument types.- Parameters:
index
- The method indexname
- The method nameargumentTypes
- The method arguments- Returns:
- true if matches
-