public class HandlerMethod
extends java.lang.Object
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.
| Modifier and Type | Class and Description |
|---|---|
protected class |
HandlerMethod.HandlerMethodParameter
A MethodParameter with HandlerMethod-specific behavior.
|
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
logger |
| Modifier | Constructor and Description |
|---|---|
protected |
HandlerMethod(HandlerMethod handlerMethod)
Copy constructor for use from subclasses that accept more arguments.
|
|
HandlerMethod(java.lang.Object bean,
java.lang.reflect.Method method)
Constructor with a handler instance and a method.
|
|
HandlerMethod(java.lang.String beanName,
org.springframework.beans.factory.BeanFactory beanFactory,
java.lang.reflect.Method method)
Constructor with a bean name for the handler along with a
BeanFactory
to allow resolving the handler instance
later. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertTargetBean(java.lang.reflect.Method method,
java.lang.Object targetBean,
java.lang.Object[] args)
Assert that the target bean class is an instance of the class where the given
method is declared.
|
HandlerMethod |
createWithResolvedBean()
If the provided instance contains a bean name rather than an object instance,
the bean name is resolved before a
HandlerMethod is created and returned. |
boolean |
equals(java.lang.Object other) |
protected static java.lang.Object |
findProvidedArgument(org.springframework.core.MethodParameter parameter,
java.lang.Object... providedArgs) |
protected static java.lang.String |
formatArgumentError(org.springframework.core.MethodParameter param,
java.lang.String message) |
protected java.lang.String |
formatInvokeError(java.lang.String text,
java.lang.Object[] args) |
java.lang.Object |
getBean()
Return the bean for this handler method.
|
java.lang.Class<?> |
getBeanType()
This method returns the type of the handler for this handler method.
|
protected java.lang.reflect.Method |
getBridgedMethod()
If the bean method is a bridge method, this method returns the bridged
(user-defined) method.
|
java.lang.reflect.Method |
getMethod()
Return the method for this handler method.
|
<A extends java.lang.annotation.Annotation> |
getMethodAnnotation(java.lang.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.
|
org.springframework.core.MethodParameter[] |
getMethodParameters()
Return the method parameters for this handler method.
|
org.springframework.core.MethodParameter |
getReturnType()
Return the HandlerMethod return type.
|
org.springframework.core.MethodParameter |
getReturnValueType(java.lang.Object returnValue)
Return the actual return value type.
|
java.lang.String |
getShortLogMessage()
Return a short representation of this handler method for log message purposes.
|
int |
hashCode() |
<A extends java.lang.annotation.Annotation> |
hasMethodAnnotation(java.lang.Class<A> annotationType)
Return whether the parameter is declared with the given annotation type.
|
boolean |
isVoid()
Return
true if the method return type is void, false otherwise. |
java.lang.String |
toString() |
public HandlerMethod(java.lang.Object bean,
java.lang.reflect.Method method)
public HandlerMethod(java.lang.String beanName,
org.springframework.beans.factory.BeanFactory beanFactory,
java.lang.reflect.Method method)
BeanFactory
to allow resolving the handler instance
later.protected HandlerMethod(HandlerMethod handlerMethod)
public java.lang.Object getBean()
public java.lang.reflect.Method getMethod()
public java.lang.Class<?> getBeanType()
Note that if the bean type is a CGLIB-generated class, the original user-defined class is returned.
protected java.lang.reflect.Method getBridgedMethod()
getMethod().public org.springframework.core.MethodParameter[] getMethodParameters()
public org.springframework.core.MethodParameter getReturnType()
public org.springframework.core.MethodParameter getReturnValueType(@Nullable
java.lang.Object returnValue)
public boolean isVoid()
true if the method return type is void, false otherwise.@Nullable public <A extends java.lang.annotation.Annotation> A getMethodAnnotation(java.lang.Class<A> annotationType)
Also supports merged composed annotations with attribute overrides as of Spring Framework 4.3.
annotationType - the type of annotation to introspect the method fornull if none foundAnnotatedElementUtils.findMergedAnnotation(java.lang.reflect.AnnotatedElement, java.lang.Class<A>)public <A extends java.lang.annotation.Annotation> boolean hasMethodAnnotation(java.lang.Class<A> annotationType)
annotationType - the annotation type to look forAnnotatedElementUtils.hasAnnotation(java.lang.reflect.AnnotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation>)public HandlerMethod createWithResolvedBean()
HandlerMethod is created and returned.public java.lang.String getShortLogMessage()
public boolean equals(@Nullable
java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object@Nullable
protected static java.lang.Object findProvidedArgument(org.springframework.core.MethodParameter parameter,
@Nullable
java.lang.Object... providedArgs)
protected static java.lang.String formatArgumentError(org.springframework.core.MethodParameter param,
java.lang.String message)
protected void assertTargetBean(java.lang.reflect.Method method,
java.lang.Object targetBean,
java.lang.Object[] args)
protected java.lang.String formatInvokeError(java.lang.String text,
java.lang.Object[] args)