Class HandlerMethod
java.lang.Object
org.springframework.graphql.data.method.HandlerMethod
- Direct Known Subclasses:
- InvocableHandlerMethodSupport
Encapsulates information about a handler method consisting of a
 method and a bean.
 Provides convenient access to method parameters, the method return value,
 method annotations, etc.
 
The class may be created with a bean instance or with a bean name
 (e.g. lazy-init bean, prototype bean). Use createWithResolvedBean()
 to obtain a HandlerMethod instance with a bean instance resolved
 through the associated BeanFactory.
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classA MethodParameter with HandlerMethod-specific behavior.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsModifierConstructorDescriptionHandlerMethod(Object bean, Method method) Constructor with a handler instance and a method.HandlerMethod(String beanName, BeanFactory beanFactory, Method method) Constructor with a bean name for the handler along with aBeanFactoryto allowresolvingthe handler instance later.protectedHandlerMethod(HandlerMethod handlerMethod) Copy constructor for use from subclasses that accept more arguments.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidassertTargetBean(Method method, Object targetBean, Object[] args) Assert that the target bean class is an instance of the class where the given method is declared.If the provided instance contains a bean name rather than an object instance, the bean name is resolved before aHandlerMethodis created and returned.booleanprotected static ObjectfindProvidedArgument(MethodParameter parameter, Object... providedArgs) protected static StringformatArgumentError(MethodParameter param, String message) protected StringformatInvokeError(String text, Object[] args) getBean()Return the bean for this handler method.Class<?> This method returns the type of the handler for this handler method.protected MethodIf the bean method is a bridge method, this method returns the bridged (user-defined) method.Return the method for this handler method.<A extends Annotation>
 AgetMethodAnnotation(Class<A> annotationType) Return a single annotation on the underlying method traversing its super methods if no annotation can be found on the given method itself.Return the method parameters for this handler method.Return the HandlerMethod return type.getReturnValueType(Object returnValue) Return the actual return value type.Return a short representation of this handler method for log message purposes.inthashCode()<A extends Annotation>
 booleanhasMethodAnnotation(Class<A> annotationType) Return whether the parameter is declared with the given annotation type.booleanisVoid()Returntrueif the method return type is void,falseotherwise.toString()
- 
Field Details- 
logger
 
- 
- 
Constructor Details- 
HandlerMethod
- 
HandlerMethodConstructor with a bean name for the handler along with aBeanFactoryto allowresolvingthe handler instance later.- Parameters:
- beanName- the bean name
- beanFactory- the bean factory to use for bean resolution
- method- the handler method
 
- 
HandlerMethodCopy constructor for use from subclasses that accept more arguments.- Parameters:
- handlerMethod- the handler method
 
 
- 
- 
Method Details- 
getBeanReturn the bean for this handler method.
- 
getMethodReturn the method for this handler method.
- 
getBeanTypeThis method returns the type of the handler for this handler method.Note that if the bean type is a CGLIB-generated class, the original user-defined class is returned. 
- 
getBridgedMethodIf the bean method is a bridge method, this method returns the bridged (user-defined) method. Otherwise it returns the same method asgetMethod().
- 
getMethodParametersReturn the method parameters for this handler method.
- 
getReturnTypeReturn the HandlerMethod return type.
- 
getReturnValueTypeReturn the actual return value type.- Parameters:
- returnValue- the return value instance, can be- null
 
- 
isVoidpublic boolean isVoid()Returntrueif the method return type is void,falseotherwise.
- 
getMethodAnnotationReturn a single annotation on the underlying method traversing its super methods if no annotation can be found on the given method itself.Also supports merged composed annotations with attribute overrides as of Spring Framework 4.3. - Type Parameters:
- A- the annotation type
- Parameters:
- annotationType- the type of annotation to introspect the method for
- Returns:
- the annotation, or nullif none found
- See Also:
 
- 
hasMethodAnnotationReturn whether the parameter is declared with the given annotation type.- Type Parameters:
- A- the annotation type
- Parameters:
- annotationType- the annotation type to look for
- See Also:
 
- 
createWithResolvedBeanIf the provided instance contains a bean name rather than an object instance, the bean name is resolved before aHandlerMethodis created and returned.
- 
getShortLogMessageReturn a short representation of this handler method for log message purposes.
- 
equals
- 
hashCode
- 
toString
- 
findProvidedArgument@Nullable protected static Object findProvidedArgument(MethodParameter parameter, @Nullable Object... providedArgs) 
- 
formatArgumentError
- 
assertTargetBeanAssert that the target bean class is an instance of the class where the given method is declared. In some cases the actual endpoint instance at request- processing time may be a JDK dynamic proxy (lazy initialization, prototype beans, and others). Endpoint classes that require proxying should prefer class-based proxy mechanisms.- Parameters:
- method- the handler method
- targetBean- the bean instance
- args- the method arguments
 
- 
formatInvokeError
 
-