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
ExecutableMethodsDefinition.- Since:
- 3.0
- Author:
- Denis Stepanov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordInternal class representing method's metadata. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractExecutableMethodsDefinition(AbstractExecutableMethodsDefinition.MethodReference[] methodsReferences) -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(BeanContext beanContext) Configure the component for the given bean context.voidconfigure(Environment environment) Configure the component for the given environment.protected ObjectTriggers the invocation of the method at index.<R> Optional<ExecutableMethod<T,R>> findMethod(String name, Class<?>... argumentTypes) Finds a singleExecutableMethodfor the given name and argument types.<R> Stream<ExecutableMethod<T,R>> findPossibleMethods(String name) Finds possible methods for the given method name.protected final MethodgetAccessibleTargetMethodByIndex(int index) FindMethodrepresentation at the method by index.<R> ExecutableMethod<T,R> getExecutableMethodByIndex(int index) GetsExecutableMethodmethod by its index.protected <R> @Nullable ExecutableMethod<T,R> Finds executable method or returns a null otherwise.protected abstract MethodgetTargetMethodByIndex(int index) FindMethodrepresentation at the method by index.protected final booleanmethodAtIndexMatches(int index, String name, Class<?>[] argumentTypes) Checks if the method at index matches name and argument types.protected final RuntimeExceptionunknownDispatchAtIndexException(int index) Creates a new exception when the dispatch at index is not found.protected final ThrowableunknownMethodAtIndexException(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, waitMethods inherited from interface io.micronaut.context.EnvironmentConfigurable
hasPropertyExpressions
-
Constructor Details
-
AbstractExecutableMethodsDefinition
protected AbstractExecutableMethodsDefinition(AbstractExecutableMethodsDefinition.MethodReference[] methodsReferences)
-
-
Method Details
-
configure
Description copied from interface:EnvironmentConfigurableConfigure the component for the given environment.- Specified by:
configurein interfaceEnvironmentConfigurable- Parameters:
environment- The environment
-
configure
Description copied from interface:BeanContextConfigurableConfigure the component for the given bean context.- Specified by:
configurein interfaceBeanContextConfigurable- Parameters:
beanContext- The bean context
-
getExecutableMethods
- Specified by:
getExecutableMethodsin interfaceExecutableMethodsDefinition<T>- Returns:
- The
ExecutableMethodinstances for this definition
-
findMethod
Description copied from interface:ExecutableMethodsDefinitionFinds a singleExecutableMethodfor the given name and argument types.- Specified by:
findMethodin 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:ExecutableMethodsDefinitionFinds possible methods for the given method name.- Specified by:
findPossibleMethodsin interfaceExecutableMethodsDefinition<T>- Type Parameters:
R- The return type- Parameters:
name- The method name- Returns:
- The possible methods
-
getExecutableMethodByIndex
GetsExecutableMethodmethod by its 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
FindMethodrepresentation at the method by index. Used byMethodReference.getTargetMethod().- Parameters:
index- The index- Returns:
- The method
-
getAccessibleTargetMethodByIndex
FindMethodrepresentation 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
-