T
- The type@Internal public abstract class AbstractExecutableMethodsDefinition<T> extends java.lang.Object implements ExecutableMethodsDefinition<T>, EnvironmentConfigurable
ExecutableMethodsDefinition
.Modifier and Type | Class and Description |
---|---|
static class |
AbstractExecutableMethodsDefinition.MethodReference
Internal class representing method's metadata.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractExecutableMethodsDefinition(AbstractExecutableMethodsDefinition.MethodReference[] methodsReferences) |
Modifier and Type | Method and Description |
---|---|
void |
configure(Environment environment)
Configure the component for the given environment.
|
protected java.lang.Object |
dispatch(int index,
T target,
java.lang.Object[] args)
Triggers the invocation of the method at index.
|
<R> java.util.Optional<ExecutableMethod<T,R>> |
findMethod(java.lang.String name,
java.lang.Class<?>... argumentTypes)
Finds a single
ExecutableMethod for the given name and argument types. |
<R> java.util.stream.Stream<ExecutableMethod<T,R>> |
findPossibleMethods(java.lang.String name)
Finds possible methods for the given method name.
|
<R> ExecutableMethod<T,R> |
getExecutableMethodByIndex(int index)
Gets
ExecutableMethod method by it's index. |
java.util.Collection<ExecutableMethod<T,?>> |
getExecutableMethods() |
protected <R> ExecutableMethod<T,R> |
getMethod(java.lang.String name,
java.lang.Class<?>... argumentTypes)
Finds executable method or returns a null otherwise.
|
protected abstract java.lang.reflect.Method |
getTargetMethodByIndex(int index)
Find
Method representation at the method by index. |
protected boolean |
methodAtIndexMatches(int index,
java.lang.String name,
java.lang.Class[] argumentTypes)
Checks if the method at index matches name and argument types.
|
protected java.lang.RuntimeException |
unknownDispatchAtIndexException(int index)
Creates a new exception when the dispatch at index is not found.
|
protected java.lang.Throwable |
unknownMethodAtIndexException(int index)
Creates a new exception when the method at index is not found.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasPropertyExpressions
protected AbstractExecutableMethodsDefinition(AbstractExecutableMethodsDefinition.MethodReference[] methodsReferences)
public void configure(Environment environment)
EnvironmentConfigurable
configure
in interface EnvironmentConfigurable
environment
- The environmentpublic java.util.Collection<ExecutableMethod<T,?>> getExecutableMethods()
getExecutableMethods
in interface ExecutableMethodsDefinition<T>
ExecutableMethod
instances for this definitionpublic <R> java.util.Optional<ExecutableMethod<T,R>> findMethod(java.lang.String name, java.lang.Class<?>... argumentTypes)
ExecutableMethodsDefinition
ExecutableMethod
for the given name and argument types.findMethod
in interface ExecutableMethodsDefinition<T>
R
- The return typename
- The method nameargumentTypes
- The argument typesExecutableMethod
public <R> java.util.stream.Stream<ExecutableMethod<T,R>> findPossibleMethods(java.lang.String name)
ExecutableMethodsDefinition
findPossibleMethods
in interface ExecutableMethodsDefinition<T>
R
- The return typename
- The method namepublic <R> ExecutableMethod<T,R> getExecutableMethodByIndex(int index)
ExecutableMethod
method by it's index.R
- The result typeindex
- The method indexExecutableMethod
@Nullable protected <R> ExecutableMethod<T,R> getMethod(java.lang.String name, java.lang.Class<?>... argumentTypes)
R
- The return typename
- The method nameargumentTypes
- The method argumentsExecutableMethod
protected java.lang.Object dispatch(int index, T target, java.lang.Object[] args)
Executable.invoke(Object, Object...)
.index
- The method indextarget
- The targetargs
- The argumentsprotected abstract java.lang.reflect.Method getTargetMethodByIndex(int index)
Method
representation at the method by index. Used by MethodReference.getTargetMethod()
.index
- The indexprotected final java.lang.Throwable unknownMethodAtIndexException(int index)
index
- The method indexprotected final java.lang.RuntimeException unknownDispatchAtIndexException(int index)
index
- The method indexprotected final boolean methodAtIndexMatches(int index, java.lang.String name, java.lang.Class[] argumentTypes)
index
- The method indexname
- The method nameargumentTypes
- The method arguments