ConfigManager { public ConfigDescriptor getConfigDescriptor(Config configurationProxy) { Class<?> inter = configurationProxy.getClass().getInterfaces()[0]; ConfigGroup group = inter.getAnnotation(ConfigGroup.class); if (group == null) { throw new IllegalArgumentException("Not a config group"); } final List<ConfigSectionDescriptor> sections = Arrays.stream(inter.getDeclaredFields()) .filter(m -> m.isAnnotationPresent(ConfigSection.class) && m.getType() == String.class) .map(m -> { try { return new ConfigSectionDescriptor( String.valueOf(m.get(inter)), m.getDeclaredAnnotation(ConfigSection.class) ); } catch (IllegalAccessException e) { log.warn("Unable to load section {}::{}", inter.getSimpleName(), m.getName()); return null; } }) .filter(Objects::nonNull) .sorted((a, b) -> ComparisonChain.start() .compare(a.getSection().position(), b.getSection().position()) .compare(a.getSection().name(), b.getSection().name()) .result()) .collect(Collectors.toList()); final List<ConfigItemDescriptor> items = Arrays.stream(inter.getMethods()) .filter(m -> m.getParameterCount() == 0 && m.isAnnotationPresent(ConfigItem.class)) .map(m -> new ConfigItemDescriptor( m.getDeclaredAnnotation(ConfigItem.class), m.getReturnType(), m.getDeclaredAnnotation(Range.class), m.getDeclaredAnnotation(Alpha.class), m.getDeclaredAnnotation(Units.class) )) .sorted((a, b) -> ComparisonChain.start() .compare(a.getItem().position(), b.getItem().position()) .compare(a.getItem().name(), b.getItem().name()) .result()) .collect(Collectors.toList()); return new ConfigDescriptor(group, sections, items); } @Inject  ConfigManager(
		@Named("config") File config,
		ScheduledExecutorService scheduledExecutorService,
		EventBus eventBus,
		OkHttpClient okHttpClient); final void switchSession(AccountSession session); void load(); void importLocal(); T getConfig(Class<T> clazz); List<String> getConfigurationKeys(String prefix); String getConfiguration(String groupName, String key); T getConfiguration(String groupName, String key, Class<T> clazz); void setConfiguration(String groupName, String key, String value); void setConfiguration(String groupName, String key, Object value); void unsetConfiguration(String groupName, String key); ConfigDescriptor getConfigDescriptor(Config configurationProxy); void setDefaultConfiguration(Object proxy, boolean override);  }
@Test public void testGetConfigDescriptor() throws IOException { AccountSession accountSession = new AccountSession(UUID.randomUUID(), Instant.now()); accountSession.setUsername("test"); TestConfig conf = manager.getConfig(TestConfig.class); ConfigDescriptor descriptor = manager.getConfigDescriptor(conf); Assert.assertEquals(1, descriptor.getItems().size()); }