|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.scr.impl.helper.ActivateMethod
public class ActivateMethod
Nested Class Summary | |
---|---|
static class |
ActivateMethod.ActivatorParameter
|
Field Summary | |
---|---|
protected static Class |
BUNDLE_CONTEXT_CLASS
|
protected static Class |
COMPONENT_CONTEXT_CLASS
|
protected static Class |
INTEGER_CLASS
|
protected static Class |
MAP_CLASS
|
protected static Class |
SERVICE_REFERENCE_CLASS
|
Constructor Summary | |
---|---|
ActivateMethod(AbstractComponentManager componentManager,
String methodName,
boolean methodRequired,
Class componentClass)
|
Method Summary | |
---|---|
protected static boolean |
accept(Method method,
boolean acceptPrivate,
boolean acceptPackage)
Returns true if the method is acceptable to be returned from the
getMethod(Class, String, Class[], boolean, boolean) and also
makes the method accessible. |
protected boolean |
acceptEmpty()
|
protected Method |
doFindMethod(Class targetClass,
boolean acceptPrivate,
boolean acceptPackage)
|
protected Class[] |
getAcceptedParameterTypes()
|
protected Class |
getComponentClass()
|
protected AbstractComponentManager |
getComponentManager()
|
Method |
getMethod(Class clazz,
String name,
Class[] parameterTypes,
boolean acceptPrivate,
boolean acceptPackage)
Finds the named public or protected method in the given class or any super class. |
protected String |
getMethodName()
|
protected String |
getMethodNamePrefix()
|
static String |
getPackageName(Class clazz)
Returns the name of the package to which the class belongs or an empty string if the class is in the default package. |
protected Object[] |
getParameters(Method method,
Object rawParameter)
Returns the parameter array created from the rawParameter
using the actual parameter type list of the method . |
boolean |
invoke(Object componentInstance,
Object rawParameter,
boolean methodCallFailureResult)
Calls the declared method on the given component with the provided method call arguments. |
protected boolean |
isDS11()
|
boolean |
methodExists()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Class COMPONENT_CONTEXT_CLASS
protected static final Class BUNDLE_CONTEXT_CLASS
protected static final Class SERVICE_REFERENCE_CLASS
protected static final Class MAP_CLASS
protected static final Class INTEGER_CLASS
Constructor Detail |
---|
public ActivateMethod(AbstractComponentManager componentManager, String methodName, boolean methodRequired, Class componentClass)
Method Detail |
---|
protected Method doFindMethod(Class targetClass, boolean acceptPrivate, boolean acceptPackage) throws SuitableMethodNotAccessibleException, InvocationTargetException
SuitableMethodNotAccessibleException
InvocationTargetException
protected Object[] getParameters(Method method, Object rawParameter)
rawParameter
using the actual parameter type list of the method
.
protected String getMethodNamePrefix()
public boolean invoke(Object componentInstance, Object rawParameter, boolean methodCallFailureResult)
componentInstance
- The component instance on which to call the
methodrawParameter
- The parameter container providing the actual
parameters to provide to the called methodmethodCallFailureResult
- The result to return from this method if
calling the method resulted in an exception.
true
if the method was called successfully or the
method was not found and was not required. false
if
the method was not found but required.
methodCallFailureResult
is returned if the method was
found and called, but the method threw an exception.protected Class[] getAcceptedParameterTypes()
protected boolean acceptEmpty()
protected final AbstractComponentManager getComponentManager()
protected final boolean isDS11()
protected final String getMethodName()
protected final Class getComponentClass()
public Method getMethod(Class clazz, String name, Class[] parameterTypes, boolean acceptPrivate, boolean acceptPackage) throws SuitableMethodNotAccessibleException, InvocationTargetException
Method.setAccessible
method if required and
the method is returned. Enforcing accessibility is required to support
invocation of protected methods.
clazz
- The Class
which provides the method.name
- The name of the method.parameterTypes
- The parameters to the method. Passing
null
is equivalent to using an empty array.
null
if no such method exists in the class.
SuitableMethodNotAccessibleException
- If method with the given
name taking the parameters is found in the class but the method
is not accessible.
InvocationTargetException
- If an unexpected Throwable is caught
trying to access the desired method.protected static boolean accept(Method method, boolean acceptPrivate, boolean acceptPackage)
true
if the method is acceptable to be returned from the
getMethod(Class, String, Class[], boolean, boolean)
and also
makes the method accessible.
This method returns true
iff:
void
return typeacceptPrivate
is true
acceptPackage
is true
This method is package private for unit testing purposes. It is not meant to be called from client code.
method
- The method to checkacceptPrivate
- Whether a private method is acceptableacceptPackage
- Whether a package private method is acceptable
public static String getPackageName(Class clazz)
public boolean methodExists()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |