public class BindMethod extends BaseMethod<BindParameters,java.util.List<ValueUtils.ValueType>> implements ReferenceMethod
BaseMethod.MethodInfo<T>
Modifier and Type | Field and Description |
---|---|
private java.util.List<ValueUtils.ValueType> |
m_paramTypes |
private java.lang.String |
m_referenceClassName |
NOPReferenceMethod
Constructor and Description |
---|
BindMethod(java.lang.String methodName,
java.lang.Class<?> componentClass,
java.lang.String referenceClassName,
DSVersion dsVersion,
boolean configurableServiceProperties) |
Modifier and Type | Method and Description |
---|---|
protected BaseMethod.MethodInfo<java.util.List<ValueUtils.ValueType>> |
doFindMethod(java.lang.Class<?> targetClass,
boolean acceptPrivate,
boolean acceptPackage,
ComponentLogger logger)
Finds the method named in the
BaseMethod.m_methodName field in the given
targetClass . |
private java.lang.reflect.Method |
getComponentObjectsMethod(java.lang.Class<?> targetClass,
boolean acceptPrivate,
boolean acceptPackage,
ComponentLogger logger) |
private java.lang.reflect.Method |
getMapMethod(java.lang.Class<?> targetClass,
java.lang.Class<?> parameterClass,
boolean acceptPrivate,
boolean acceptPackage,
ComponentLogger logger)
Returns a method taking a single map parameter
or
null if no such method exists. |
protected java.lang.String |
getMethodNamePrefix() |
protected java.lang.Object[] |
getParameters(java.lang.reflect.Method method,
BindParameters bp)
Returns the parameter array created from the
rawParameter
using the actual parameter type list of the method . |
<S,T> boolean |
getServiceObject(BindParameters parameters,
org.osgi.framework.BundleContext context) |
private java.lang.reflect.Method |
getServiceObjectAssignableMethod(java.lang.Class<?> targetClass,
java.lang.Class<?> parameterClass,
boolean acceptPrivate,
boolean acceptPackage,
ComponentLogger logger)
Returns a method taking a single object whose type is assignment
compatible with the declared service type or
null if no
such method exists. |
private java.lang.reflect.Method |
getServiceObjectAssignableWithMapMethod(java.lang.Class<?> targetClass,
java.lang.Class<?> parameterClass,
boolean acceptPrivate,
boolean acceptPackage)
Returns a method taking two parameters, the first being an object
whose type is assignment compatible with the declared service type and
the second being a
Map or null if no such
method exists. |
private java.lang.reflect.Method |
getServiceObjectMethod(java.lang.Class<?> targetClass,
java.lang.Class<?> parameterClass,
boolean acceptPrivate,
boolean acceptPackage,
ComponentLogger logger)
Returns a method taking a single parameter of the exact type declared
for the service reference or
null if no such method exists. |
private java.lang.reflect.Method |
getServiceObjectWithMapMethod(java.lang.Class<?> targetClass,
java.lang.Class<?> parameterClass,
boolean acceptPrivate,
boolean acceptPackage,
ComponentLogger logger)
Returns a method taking two parameters, the first being of the exact
type declared for the service reference and the second being a
Map or null if no such method exists. |
private java.lang.reflect.Method |
getServiceReferenceMethod(java.lang.Class<?> targetClass,
boolean acceptPrivate,
boolean acceptPackage,
ComponentLogger logger)
Returns a method taking a single
ServiceReference object
as a parameter or null if no such method exists. |
protected void |
setTypes(java.util.List<ValueUtils.ValueType> types) |
accept, getComponentClass, getDSVersion, getMethod, getMethod, getMethodName, getPackageName, getState, invoke, isDS12Felix, methodExists, returnValue, setMethod
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
invoke
private final java.lang.String m_referenceClassName
private volatile java.util.List<ValueUtils.ValueType> m_paramTypes
public BindMethod(java.lang.String methodName, java.lang.Class<?> componentClass, java.lang.String referenceClassName, DSVersion dsVersion, boolean configurableServiceProperties)
protected BaseMethod.MethodInfo<java.util.List<ValueUtils.ValueType>> doFindMethod(java.lang.Class<?> targetClass, boolean acceptPrivate, boolean acceptPackage, ComponentLogger logger) throws SuitableMethodNotAccessibleException, java.lang.reflect.InvocationTargetException
BaseMethod.m_methodName
field in the given
targetClass
. 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.doFindMethod
in class BaseMethod<BindParameters,java.util.List<ValueUtils.ValueType>>
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
- null
if no acceptable method
can be found in the target class or any super class.java.lang.reflect.InvocationTargetException
- If an unexpected Throwable is caught
trying to find the requested method.SuitableMethodNotAccessibleException
protected void setTypes(java.util.List<ValueUtils.ValueType> types)
setTypes
in class BaseMethod<BindParameters,java.util.List<ValueUtils.ValueType>>
private java.lang.reflect.Method getServiceReferenceMethod(java.lang.Class<?> targetClass, boolean acceptPrivate, boolean acceptPackage, ComponentLogger logger) throws SuitableMethodNotAccessibleException, java.lang.reflect.InvocationTargetException
ServiceReference
object
as a parameter or null
if no such method exists.targetClass
- The class in which to look for the method. Only this
class is searched for the method.acceptPrivate
- true
if private methods should be
considered.acceptPackage
- true
if package private methods should
be considered.logger
- null
if no acceptable method
can be found in the target class.SuitableMethodNotAccessibleException
- If a suitable method was
found which is not accessiblejava.lang.reflect.InvocationTargetException
- If an unexpected Throwable is caught
trying to find the requested method.private java.lang.reflect.Method getComponentObjectsMethod(java.lang.Class<?> targetClass, boolean acceptPrivate, boolean acceptPackage, ComponentLogger logger) throws SuitableMethodNotAccessibleException, java.lang.reflect.InvocationTargetException
SuitableMethodNotAccessibleException
java.lang.reflect.InvocationTargetException
private java.lang.reflect.Method getServiceObjectMethod(java.lang.Class<?> targetClass, java.lang.Class<?> parameterClass, boolean acceptPrivate, boolean acceptPackage, ComponentLogger logger) throws SuitableMethodNotAccessibleException, java.lang.reflect.InvocationTargetException
null
if no such method exists.targetClass
- The class in which to look for the method. Only this
class is searched for the method.acceptPrivate
- true
if private methods should be
considered.acceptPackage
- true
if package private methods should
be considered.logger
- null
if no acceptable method
can be found in the target class.SuitableMethodNotAccessibleException
- If a suitable method was
found which is not accessiblejava.lang.reflect.InvocationTargetException
- If an unexpected Throwable is caught
trying to find the requested method.private java.lang.reflect.Method getServiceObjectAssignableMethod(java.lang.Class<?> targetClass, java.lang.Class<?> parameterClass, boolean acceptPrivate, boolean acceptPackage, ComponentLogger logger) throws SuitableMethodNotAccessibleException
null
if no
such method exists.targetClass
- The class in which to look for the method. Only this
class is searched for the method.acceptPrivate
- true
if private methods should be
considered.acceptPackage
- true
if package private methods should
be considered.logger
- null
if no acceptable method
can be found in the target class.SuitableMethodNotAccessibleException
- If a suitable method was
found which is not accessibleprivate java.lang.reflect.Method getServiceObjectWithMapMethod(java.lang.Class<?> targetClass, java.lang.Class<?> parameterClass, boolean acceptPrivate, boolean acceptPackage, ComponentLogger logger) throws SuitableMethodNotAccessibleException, java.lang.reflect.InvocationTargetException
Map
or null
if no such method exists.targetClass
- The class in which to look for the method. Only this
class is searched for the method.acceptPrivate
- true
if private methods should be
considered.acceptPackage
- true
if package private methods should
be considered.logger
- null
if no acceptable method
can be found in the target class.SuitableMethodNotAccessibleException
- If a suitable method was
found which is not accessiblejava.lang.reflect.InvocationTargetException
- If an unexpected Throwable is caught
trying to find the requested method.private java.lang.reflect.Method getServiceObjectAssignableWithMapMethod(java.lang.Class<?> targetClass, java.lang.Class<?> parameterClass, boolean acceptPrivate, boolean acceptPackage) throws SuitableMethodNotAccessibleException
Map
or null
if no such
method exists.targetClass
- The class in which to look for the method. Only this
class is searched for the method.acceptPrivate
- true
if private methods should be
considered.acceptPackage
- true
if package private methods should
be considered.null
if no acceptable method
can be found in the target class.SuitableMethodNotAccessibleException
- If a suitable method was
found which is not accessibleprivate java.lang.reflect.Method getMapMethod(java.lang.Class<?> targetClass, java.lang.Class<?> parameterClass, boolean acceptPrivate, boolean acceptPackage, ComponentLogger logger) throws SuitableMethodNotAccessibleException, java.lang.reflect.InvocationTargetException
null
if no such method exists.targetClass
- The class in which to look for the method. Only this
class is searched for the method.acceptPrivate
- true
if private methods should be
considered.acceptPackage
- true
if package private methods should
be considered.logger
- null
if no acceptable method
can be found in the target class.SuitableMethodNotAccessibleException
- If a suitable method was
found which is not accessiblejava.lang.reflect.InvocationTargetException
- If an unexpected Throwable is caught
trying to find the requested method.public <S,T> boolean getServiceObject(BindParameters parameters, org.osgi.framework.BundleContext context)
getServiceObject
in interface ReferenceMethod
protected java.lang.Object[] getParameters(java.lang.reflect.Method method, BindParameters bp)
BaseMethod
rawParameter
using the actual parameter type list of the method
.getParameters
in class BaseMethod<BindParameters,java.util.List<ValueUtils.ValueType>>
protected java.lang.String getMethodNamePrefix()
getMethodNamePrefix
in class BaseMethod<BindParameters,java.util.List<ValueUtils.ValueType>>