felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Neubauer (JIRA)" <j...@apache.org>
Subject [jira] Created: (FELIX-82) Dep Manager does not handle inherited callback methods right
Date Tue, 20 Jun 2006 09:44:29 GMT
Dep Manager does not handle inherited callback methods right

         Key: FELIX-82
         URL: http://issues.apache.org/jira/browse/FELIX-82
     Project: Felix
        Type: Bug

  Components: Dependency Manager  
    Reporter: Peter Neubauer

This does not work for inherited classes as the reflection jsut works for the current type.
In order to be abelt o define callback even in e.g. Abstract classes, one needs to go up the
hirarchy in order to find these methods.


private void invokeCallbackMethod( Object instance, String methodName,
            ServiceReference reference, Object service )
            throws NoSuchMethodException
        Method method = null;
        Class clazz = instance.getClass();
        AccessibleObject.setAccessible( clazz.getDeclaredMethods(), true );
                method = clazz.getDeclaredMethod( methodName, new Class[] {
                        ServiceReference.class, Object.class } );
                method.invoke( instance, new Object[] { reference, service } );
            catch ( NoSuchMethodException e )

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message