class IntentManagerImpl implements IntentManager {

    @Override
    public List<Object> getIntentsFromService(Object serviceBean) {
        List<Object> intents = new ArrayList<>();
        if (serviceBean instanceof IntentsProvider) {
            intents.addAll(((IntentsProvider)serviceBean).getIntents());
        }
        Features features = serviceBean.getClass().getAnnotation(Features.class);
        if (features != null && features.classes() != null) {
            for (Class<?> clazz : features.classes()) {
                try {
                    intents.add(clazz.newInstance());
                } catch (Exception e) {
                    throw new RuntimeException("Could not instantiate feature from class " + clazz.getName(), e);
                }
            }
        }
        return intents;
    }

}