private void addLifecycleMethods()

in org.eclipse.sisu.inject/src/org/eclipse/sisu/bean/LifecycleBuilder.java [79:109]


    private void addLifecycleMethods( final Class<?> clazz )
    {
        boolean foundStartMethod = false, foundStopMethod = false;
        for ( final Method m : clazz.getDeclaredMethods() )
        {
            if ( isCandidateMethod( m ) )
            {
                if ( m.isAnnotationPresent( PostConstruct.class ) )
                {
                    foundStartMethod = true;
                    if ( !isOverridden( m ) )
                    {
                        startMethods.add( m );
                    }
                }
                else if ( m.isAnnotationPresent( PreDestroy.class ) )
                {
                    foundStopMethod = true;
                    if ( !isOverridden( m ) )
                    {
                        stopMethods.add( m );
                    }
                }
                if ( foundStartMethod && foundStopMethod )
                {
                    break; // stop once we've seen both annotations
                }
            }
        }
        hierarchy.add( clazz );
    }