Package org.apache.felix.scr.impl.inject
Class BindMethod
- java.lang.Object
-
- org.apache.felix.scr.impl.inject.BaseMethod<BindParameters,List<org.apache.felix.scr.impl.inject.BindMethod.ParamType>>
-
- org.apache.felix.scr.impl.inject.BindMethod
-
- All Implemented Interfaces:
ReferenceMethod
- Direct Known Subclasses:
UnbindMethod
,UpdatedMethod
public class BindMethod extends BaseMethod<BindParameters,List<org.apache.felix.scr.impl.inject.BindMethod.ParamType>> implements ReferenceMethod
Component method to be invoked on service (un)binding.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.felix.scr.impl.inject.BaseMethod
BaseMethod.MethodInfo<T>
-
-
Constructor Summary
Constructors Constructor Description BindMethod(String methodName, Class<?> componentClass, String referenceClassName, DSVersion dsVersion, boolean configurableServiceProperties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BaseMethod.MethodInfo<List<org.apache.felix.scr.impl.inject.BindMethod.ParamType>>
doFindMethod(Class<?> targetClass, boolean acceptPrivate, boolean acceptPackage, SimpleLogger logger)
Finds the method named in theBaseMethod.m_methodName
field in the giventargetClass
.protected String
getMethodNamePrefix()
protected Object[]
getParameters(Method method, BindParameters bp)
Returns the parameter array created from therawParameter
using the actual parameter type list of themethod
.<S,T>
booleangetServiceObject(ComponentContextImpl<S> key, RefPair<S,T> refPair, org.osgi.framework.BundleContext context, SimpleLogger logger)
MethodResult
invoke(Object componentInstance, ComponentContextImpl<?> componentContext, RefPair<?,?> refPair, MethodResult methodCallFailureResult, SimpleLogger logger)
protected void
setTypes(List<org.apache.felix.scr.impl.inject.BindMethod.ParamType> types)
-
Methods inherited from class org.apache.felix.scr.impl.inject.BaseMethod
accept, getComponentClass, getDSVersion, getMethod, getMethodName, getPackageName, invoke, isDS12Felix, methodExists, returnValue
-
-
-
-
Method Detail
-
doFindMethod
protected BaseMethod.MethodInfo<List<org.apache.felix.scr.impl.inject.BindMethod.ParamType>> doFindMethod(Class<?> targetClass, boolean acceptPrivate, boolean acceptPackage, SimpleLogger logger) throws SuitableMethodNotAccessibleException, InvocationTargetException
Finds the method named in theBaseMethod.m_methodName
field in the giventargetClass
. If the target class has no acceptable method the class hierarchy is traversed until a method is found or the root of the class hierarchy is reached without finding a method.- Specified by:
doFindMethod
in classBaseMethod<BindParameters,List<org.apache.felix.scr.impl.inject.BindMethod.ParamType>>
- Parameters:
targetClass
- The class in which to look for the methodacceptPrivate
-true
if private methods should be considered.acceptPackage
-true
if package private methods should be considered.logger
-- Returns:
- The requested method or
null
if no acceptable method can be found in the target class or any super class. - Throws:
InvocationTargetException
- If an unexpected Throwable is caught trying to find the requested method.SuitableMethodNotAccessibleException
-
setTypes
protected void setTypes(List<org.apache.felix.scr.impl.inject.BindMethod.ParamType> types)
- Specified by:
setTypes
in classBaseMethod<BindParameters,List<org.apache.felix.scr.impl.inject.BindMethod.ParamType>>
-
getServiceObject
public <S,T> boolean getServiceObject(ComponentContextImpl<S> key, RefPair<S,T> refPair, org.osgi.framework.BundleContext context, SimpleLogger logger)
- Specified by:
getServiceObject
in interfaceReferenceMethod
-
invoke
public MethodResult invoke(Object componentInstance, ComponentContextImpl<?> componentContext, RefPair<?,?> refPair, MethodResult methodCallFailureResult, SimpleLogger logger)
- Specified by:
invoke
in interfaceReferenceMethod
-
getParameters
protected Object[] getParameters(Method method, BindParameters bp)
Description copied from class:BaseMethod
Returns the parameter array created from therawParameter
using the actual parameter type list of themethod
.- Specified by:
getParameters
in classBaseMethod<BindParameters,List<org.apache.felix.scr.impl.inject.BindMethod.ParamType>>
- Returns:
-
getMethodNamePrefix
protected String getMethodNamePrefix()
- Overrides:
getMethodNamePrefix
in classBaseMethod<BindParameters,List<org.apache.felix.scr.impl.inject.BindMethod.ParamType>>
-
-