Source:
protected void configure() throws Exception { addModule(new NinjaBaseModule(ninjaProperties)); String applicationModuleClassName = resolveApplicationClassName(APPLICATION_GUICE_MODULE_CONVENTION_LOCATION); AbstractModule applicationModule = null; if (doesClassExist(applicationModuleClassName)) { Class<?> applicationModuleClass = Class .forName(applicationModuleClassName); try { applicationModule = (AbstractModule) applicationModuleClass .getConstructor(NinjaProperties.class).newInstance(ninjaProperties); } catch (NoSuchMethodException e) { applicationModule = (AbstractModule) applicationModuleClass .getConstructor().newInstance(); } } if (applicationModule == null || !(applicationModule instanceof FrameworkModule)) { logger.info("Enabling Ninja classic configuration"); addModule(new NinjaClassicModule(ninjaProperties)); } if (applicationModule != null) { addModule(applicationModule); } String applicationNinjaClassName = resolveApplicationClassName(NINJA_CONVENTION_LOCATION); final Class<? extends Ninja> ninjaClass; if (doesClassExist(applicationNinjaClassName)) { final Class<?> clazzPotentially = Class.forName(applicationNinjaClassName); if (Ninja.class.isAssignableFrom(clazzPotentially)) { ninjaClass = (Class<? extends Ninja>) clazzPotentially; } else { final String ERROR_MESSAGE = String.format( "Found a class %s in your application's conf directory." + " This class does not implement Ninja interface %s. " + " Please implement the interface or remove the class.", applicationNinjaClassName, Ninja.class.getName()); logger.error(ERROR_MESSAGE); throw new IllegalStateException(ERROR_MESSAGE); } } else { ninjaClass = NinjaDefault.class; } addModule(new AbstractModule() { @Override protected void configure() { bind(Ninja.class).to(ninjaClass).in(Singleton.class); Multibinder.newSetBinder(binder(), ParamParser.class); } }); }

Target:
protected void configure() throws Exception { addModule(new NinjaBaseModule(ninjaProperties)); String applicationModuleClassName = resolveApplicationClassName(APPLICATION_GUICE_MODULE_CONVENTION_LOCATION); AbstractModule applicationModule = null; if (doesClassExist(applicationModuleClassName)) { Class<?> applicationModuleClass = Class .forName(applicationModuleClassName); try { applicationModule = (AbstractModule) applicationModuleClass .getConstructor(NinjaProperties.class).newInstance(ninjaProperties); } catch (NoSuchMethodException e) { applicationModule = (AbstractModule) applicationModuleClass .getConstructor().newInstance(); } } if (applicationModule == null || !(applicationModule instanceof FrameworkModule)) { logger.info("Enabling Ninja classic configuration"); addModule(new NinjaClassicModule(ninjaProperties)); } if (applicationModule != null) { addModule(applicationModule); } String applicationNinjaClassName = resolveApplicationClassName(NINJA_CONVENTION_LOCATION); final Class<? extends Ninja> ninjaClass; if (doesClassExist(applicationNinjaClassName)) { final Class<?> clazzPotentially = Class.forName(applicationNinjaClassName); if (Ninja.class.isAssignableFrom(clazzPotentially)) { ninjaClass = (Class<? extends Ninja>) clazzPotentially; } else { final String ERROR_MESSAGE = String.format( "Found a class %s in your application's conf directory." + " This class does not implement Ninja interface %s. " + " Please implement the interface or remove the class.", applicationNinjaClassName, Ninja.class.getName()); logger.error(ERROR_MESSAGE); throw new IllegalStateException(ERROR_MESSAGE); } } else { ninjaClass = NinjaDefault.class; } addModule(new AbstractModule() { @Override protected void configure() { bind(Ninja.class).to(ninjaClass).in(Singleton.class); } }); }