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
  • Constructor Details

  • Method Details

    • configure

      public void configure(Environment environment)
      Description copied from interface: EnvironmentConfigurable
      Configure the component for the given environment.
      Specified by:
      configure in interface EnvironmentConfigurable
      Parameters:
      environment - The environment
    • configure

      public void configure(BeanContext beanContext)
      Description copied from interface: BeanContextConfigurable
      Configure the component for the given bean context.
      Specified by:
      configure in interface BeanContextConfigurable
      Parameters:
      beanContext - The bean context
    • getExecutableMethods

      public Collection<ExecutableMethod<T,?>> getExecutableMethods()
      Specified by:
      getExecutableMethods in interface ExecutableMethodsDefinition<T>
      Returns:
      The ExecutableMethod instances for this definition
    • findMethod

      public <R> Optional<ExecutableMethod<T,R>> findMethod(String name, Class<?>... argumentTypes)
      Description copied from interface: ExecutableMethodsDefinition
      Finds a single ExecutableMethod for the given name and argument types.
      Specified by:
      findMethod in interface ExecutableMethodsDefinition<T>
      Type Parameters:
      R - The return type
      Parameters:
      name - The method name
      argumentTypes - The argument types
      Returns:
      An optional ExecutableMethod
    • findPossibleMethods

      public <R> Stream<ExecutableMethod<T,R>> findPossibleMethods(String name)
      Description copied from interface: ExecutableMethodsDefinition
      Finds possible methods for the given method name.
      Specified by:
      findPossibleMethods in interface ExecutableMethodsDefinition<T>
      Type Parameters:
      R - The return type
      Parameters:
      name - The method name
      Returns:
      The possible methods
    • getExecutableMethodByIndex

      public <R> ExecutableMethod<T,R> getExecutableMethodByIndex(int index)
      Gets ExecutableMethod method 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 name
      argumentTypes - The method arguments
      Returns:
      The ExecutableMethod
    • dispatch

      protected Object dispatch(int index, T target, Object[] args)
      Triggers the invocation of the method at index. Used by Executable.invoke(Object, Object...).
      Parameters:
      index - The method index
      target - The target
      args - The arguments
      Returns:
      The result
    • getTargetMethodByIndex

      protected abstract Method getTargetMethodByIndex(int index)
      Find Method representation at the method by index. Used by MethodReference.getTargetMethod().
      Parameters:
      index - The index
      Returns:
      The method
    • getAccessibleTargetMethodByIndex

      protected final Method getAccessibleTargetMethodByIndex(int index)
      Find Method representation at the method by index. Used by MethodReference.getTargetMethod().
      Parameters:
      index - The index
      Returns:
      The method
      Since:
      3.4.0
    • unknownMethodAtIndexException

      protected final Throwable unknownMethodAtIndexException(int index)
      Creates a new exception when the method at index is not found.
      Parameters:
      index - The method index
      Returns:
      The exception
    • unknownDispatchAtIndexException

      protected final RuntimeException unknownDispatchAtIndexException(int index)
      Creates a new exception when the dispatch at index is not found.
      Parameters:
      index - The method index
      Returns:
      The exception
    • methodAtIndexMatches

      protected final boolean methodAtIndexMatches(int index, String name, Class<?>[] argumentTypes)
      Checks if the method at index matches name and argument types.
      Parameters:
      index - The method index
      name - The method name
      argumentTypes - The method arguments
      Returns:
      true if matches