private void validate(Genie genie) { Map<Object, Binder> map = C.newMap(); for (Binder<?> binder : binders) { Object spec = binder.beanSpec(genie); if (map.containsKey(spec)) { throw E.invalidConfiguration("Duplicate bean spec found: ", spec); } map.put(spec, binder); } }
private void validate(Genie genie) { Map<Object, Binder> map = C.newMap(); for (Binder<?> binder : binders) { Object spec = binder.beanSpec(genie); if (map.containsKey(spec)) { throw E.invalidConfiguration("Duplicate bean spec found: ", spec); } map.put(spec, binder); } }
/** * Register this binder to `Genie` * * @param genie * the dependency injector */ public void register(Genie genie) { if (null == provider) { if (null != constructor) { provider = genie.buildConstructor( constructor, BeanSpec.of(constructor.getDeclaringClass(), null, genie), new HashSet<BeanSpec>()); } else if (null != impl) { provider = new LazyProvider<>(impl, genie); } } if (!bound()) { throw new InjectException("Cannot register without binding specified"); } BeanSpec spec = beanSpec(genie); genie.addIntoRegistry(spec, genie.decorate(spec, provider, true), annotations.isEmpty() && S.blank(name)); if (fireEvent || forceFireEvent) { genie.fireProviderRegisteredEvent(type); } }
/** * Register this binder to `Genie` * * @param genie * the dependency injector */ public void register(Genie genie) { if (null == provider) { if (null != constructor) { provider = genie.buildConstructor( constructor, BeanSpec.of(constructor.getDeclaringClass(), null, genie), new HashSet<BeanSpec>()); } else if (null != impl) { provider = new LazyProvider<>(impl, genie); } } if (!bound()) { throw new InjectException("Cannot register without binding specified"); } BeanSpec spec = beanSpec(genie); genie.addIntoRegistry(spec, genie.decorate(spec, provider, true), annotations.isEmpty() && S.blank(name)); if (fireEvent || forceFireEvent) { genie.fireProviderRegisteredEvent(type); } }