public class HandlerMethod
extends java.lang.Object
method
and a bean
. Provides convenient access to method parameters,
method return value, method annotations.
The class may be created with a bean instance or with a bean name (e.g. lazy bean,
prototype bean). Use createWithResolvedBean()
to obtain an HandlerMethod
instance with a bean instance initialized through the bean factory.
Modifier | Constructor and Description |
---|---|
protected |
HandlerMethod(HandlerMethod handlerMethod)
Copy constructor for use in sub-classes.
|
|
HandlerMethod(java.lang.Object bean,
java.lang.reflect.Method method)
Create an instance from a bean instance and a method.
|
|
HandlerMethod(java.lang.Object bean,
java.lang.String methodName,
java.lang.Class<?>... parameterTypes)
Create an instance from a bean instance, method name, and parameter types.
|
|
HandlerMethod(java.lang.String beanName,
BeanFactory beanFactory,
java.lang.reflect.Method method)
Create an instance from a bean name, a method, and a
BeanFactory . |
Modifier and Type | Method and Description |
---|---|
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 obj) |
java.lang.Object |
getBean()
Returns the bean for this handler method.
|
java.lang.Class<?> |
getBeanType()
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()
Returns the method for this handler method.
|
<A extends java.lang.annotation.Annotation> |
getMethodAnnotation(java.lang.Class<A> annotationType)
Returns a single annotation on the underlying method traversing its super methods if no
annotation can be found on the given method itself.
|
MethodParameter[] |
getMethodParameters()
Returns the method parameters for this handler method.
|
MethodParameter |
getReturnType()
Return the HandlerMethod return type.
|
MethodParameter |
getReturnValueType(java.lang.Object returnValue)
Return the actual return value type.
|
java.lang.String |
getShortLogMessage() |
int |
hashCode() |
boolean |
isVoid()
Returns
true if the method return type is void, false otherwise. |
java.lang.String |
toString() |
protected final Log logger
public HandlerMethod(java.lang.Object bean, java.lang.reflect.Method method)
public HandlerMethod(java.lang.Object bean, java.lang.String methodName, java.lang.Class<?>... parameterTypes) throws java.lang.NoSuchMethodException
java.lang.NoSuchMethodException
- when the method cannot be foundpublic HandlerMethod(java.lang.String beanName, BeanFactory beanFactory, java.lang.reflect.Method method)
BeanFactory
.
The method createWithResolvedBean()
may be used later to
re-create the HandlerMethod
with an initialized the bean.protected HandlerMethod(HandlerMethod handlerMethod)
public java.lang.Object getBean()
public java.lang.reflect.Method getMethod()
public java.lang.Class<?> getBeanType()
protected java.lang.reflect.Method getBridgedMethod()
getMethod()
.public MethodParameter[] getMethodParameters()
public MethodParameter getReturnType()
public MethodParameter getReturnValueType(java.lang.Object returnValue)
public boolean isVoid()
true
if the method return type is void, false
otherwise.public <A extends java.lang.annotation.Annotation> A getMethodAnnotation(java.lang.Class<A> annotationType)
annotationType
- the type of annotation to introspect the method for.null
if none foundpublic HandlerMethod createWithResolvedBean()
HandlerMethod
is created and returned.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getShortLogMessage()
public java.lang.String toString()
toString
in class java.lang.Object