public class HandlerMethod extends Object
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 and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger
Logger that is available to subclasses
|
Constructor and Description |
---|
HandlerMethod(Object bean,
Method method)
Constructs a new handler method with the given bean instance and method.
|
HandlerMethod(Object bean,
String methodName,
Class<?>... parameterTypes)
Constructs a new handler method with the given bean instance, method name and parameters.
|
HandlerMethod(String beanName,
BeanFactory beanFactory,
Method method)
Constructs a new handler method with the given bean name and method.
|
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(Object o) |
Object |
getBean()
Returns the bean for this handler method.
|
Class<?> |
getBeanType()
Returns the type of the handler for this handler method.
|
protected Method |
getBridgedMethod()
If the bean method is a bridge method, this method returns the bridged (user-defined) method.
|
Method |
getMethod()
Returns the method for this handler method.
|
<A extends Annotation> |
getMethodAnnotation(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()
Returns the method return type, as
MethodParameter . |
int |
hashCode() |
boolean |
isVoid()
Returns
true if the method return type is void, false otherwise. |
String |
toString() |
protected final org.apache.commons.logging.Log logger
public HandlerMethod(Object bean, Method method)
bean
- the object beanmethod
- the methodpublic HandlerMethod(Object bean, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException
bean
- the object beanmethodName
- the method nameparameterTypes
- the method parameter typesNoSuchMethodException
- when the method cannot be foundpublic HandlerMethod(String beanName, BeanFactory beanFactory, Method method)
createWithResolvedBean()
is called.beanName
- the bean namebeanFactory
- the bean factory to use for bean initializationmethod
- the method for the beanpublic Object getBean()
public Method getMethod()
public Class<?> getBeanType()
protected Method getBridgedMethod()
getMethod()
.public MethodParameter[] getMethodParameters()
public MethodParameter getReturnType()
MethodParameter
.public boolean isVoid()
true
if the method return type is void, false
otherwise.public <A extends Annotation> A getMethodAnnotation(Class<A> annotationType)
annotationType
- the type of annotation to introspect the method for.null
if none foundpublic HandlerMethod createWithResolvedBean()
HandlerMethod
is created and returned.Copyright © 2015. All Rights Reserved.