Package org.apache.juneau.rest.stats
Class MethodInvoker
java.lang.Object
org.apache.juneau.rest.stats.MethodInvoker
- Direct Known Subclasses:
RestOpInvoker
A wrapper around a
Method.invoke(Object, Object...)
method that allows for basic instrumentation.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionConvenience method for callinginner().getDeclaringClass() Convenience method for callinginner().getName() getStats()
Returns the stats of this method invoker.inner()
Returns the inner method.Invokes the underlying method.Invokes the wrapped method using parameters from the specified bean store.
-
Constructor Details
-
MethodInvoker
Constructor.- Parameters:
m
- The method being wrapped.stats
- The instrumentor.
-
-
Method Details
-
inner
Returns the inner method.- Returns:
- The inner method.
-
invoke
public Object invoke(Object o, Object... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException Invokes the underlying method.- Parameters:
o
- The object the underlying method is invoked from.args
- The arguments used for the method call.- Returns:
- The result of dispatching the method represented by this object on
obj
with parametersargs
- Throws:
IllegalAccessException
- If method cannot be accessed.IllegalArgumentException
- If wrong arguments were passed to method.InvocationTargetException
- If method threw an exception.
-
invoke
public Object invoke(BeanStore beanStore, Object o) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException Invokes the wrapped method using parameters from the specified bean store.- Parameters:
beanStore
- The bean store to use to resolve parameters.o
- The object to invoke the method on.- Returns:
- The result of invoking the method.
- Throws:
IllegalAccessException
- If method cannot be accessed.IllegalArgumentException
- If wrong arguments were passed to method.InvocationTargetException
- If method threw an exception.
-
getDeclaringClass
Convenience method for callinginner().getDeclaringClass() - Returns:
- The declaring class of the method.
-
getFullName
Convenience method for callinginner().getName() - Returns:
- The name of the method.
-
getStats
Returns the stats of this method invoker.- Returns:
- The stats of this method invoker.
-