PreferenceFormBeansInfo { public String getPreferenceFormFor(final String preferenceIdentifier) { final Collection<? extends IOCBeanDef<?>> screenBeans = activityBeansInfo.lookupBeans(WorkbenchScreenActivity.class); for (final IOCBeanDef<?> beanDef : screenBeans) { for (final Annotation annotation : beanDef.getQualifiers()) { if (annotation instanceof PreferenceForm) { PreferenceForm preferenceFormQualifier = (PreferenceForm) annotation; if (preferenceIdentifier.equals(preferenceFormQualifier.value())) { return activityBeansInfo.getId(beanDef); } } } } return null; } @Inject  PreferenceFormBeansInfo(final ActivityBeansInfo activityBeansInfo); String getPreferenceFormFor(final String preferenceIdentifier);  }
@Test public void getPreferenceFormForTest() { assertEquals("MyPreference1Form", preferenceFormBeansInfo.getPreferenceFormFor("MyPreference1")); assertEquals("MyPreference2Form", preferenceFormBeansInfo.getPreferenceFormFor("MyPreference2")); assertEquals("MyPreference3Form", preferenceFormBeansInfo.getPreferenceFormFor("MyPreference3")); }