Enum Class ReflectionHelper
- All Implemented Interfaces:
Serializable,Comparable<ReflectionHelper>,Constable
Helper class for reflection operations.
This class provides static methods for caching and invoking methods.
- Author:
- codeboyzhou
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptiongetOrCache(Method method) Get or cache the metadata for the specified method.invoke(Object instance, MethodCache methodCache) Invoke the method represented by the specified method cache on the given instance with no parameters.invoke(Object instance, MethodCache methodCache, io.modelcontextprotocol.spec.McpSchema.CompleteRequest.CompleteArgument argument) Invoke the method represented by the specified method cache on the given instance with the provided argument.invoke(Object instance, MethodCache methodCache, List<Object> params) Invoke the method represented by the specified method cache on the given instance with the provided parameters.static ReflectionHelperReturns the enum constant of this class with the specified name.static ReflectionHelper[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
The singleton instance of the ReflectionHelper enum.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getOrCache
Get or cache the metadata for the specified method.- Parameters:
method- the method to cache- Returns:
- the cached method metadata
-
invoke
Invoke the method represented by the specified method cache on the given instance with the provided parameters.- Parameters:
instance- the instance on which to invoke the methodmethodCache- the method cache containing the method metadataparams- the list of parameters to pass to the method- Returns:
- the result of the method invocation
-
invoke
Invoke the method represented by the specified method cache on the given instance with no parameters.- Parameters:
instance- the instance on which to invoke the methodmethodCache- the method cache containing the method metadata- Returns:
- the result of the method invocation
-
invoke
public InvocationResult invoke(Object instance, MethodCache methodCache, io.modelcontextprotocol.spec.McpSchema.CompleteRequest.CompleteArgument argument) Invoke the method represented by the specified method cache on the given instance with the provided argument.- Parameters:
instance- the instance on which to invoke the methodmethodCache- the method cache containing the method metadataargument- the argument to pass to the method- Returns:
- the result of the method invocation
-