/** * 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); } }
private void ensureNoBinding() { E.illegalStateIf(bound(), "binding has already been specified"); }
private void ensureNoBinding() { E.illegalStateIf(bound(), "binding has already been specified"); }