@SuppressWarnings("unchecked")
    public Collection<Dependency> getDependencies(Class<? extends Plugin> pluginClass) {
        final Collection<Dependency> rval = new ArrayList<Dependency>();

        // All fields we have a look at
        final Field[] fields = pluginClass.getFields();
        final Method[] methods = pluginClass.getMethods();
        

        // Process every field
        for (final Field field : fields) {
            field.setAccessible(true);
            
            final InjectPlugin ipannotation = field.getAnnotation(InjectPlugin.class);
            if (ipannotation == null) continue;
            if (ipannotation.isOptional()) continue;

            final Dependency d = new Dependency();
            d.capabilites = ipannotation.requiredCapabilities();
            d.pluginClass = (Class<? extends Plugin>) getTrueDependencyInterfaceType(field.getType());
            d.isOptional = ipannotation.isOptional();

            rval.add(d);
        }
        
        // And setter methods as well (aka Scala hack)
        for (Method method : methods) {
            method.setAccessible(true);
            
            final InjectPlugin ipannotation = method.getAnnotation(InjectPlugin.class);
            if (ipannotation == null) continue;
            if (ipannotation.isOptional()) continue;


            final Dependency d = new Dependency();
            d.capabilites = ipannotation.requiredCapabilities();
            d.pluginClass = (Class<? extends Plugin>) getTrueDependencyInterfaceType(method.getParameterTypes()[0]);
            d.isOptional = ipannotation.isOptional();

            rval.add(d);
        }        

        return rval;
    }