ServiceBindingBuilder<?> builder = binder.bindFactory(new InstanceSupplierFactoryBridge<>(supplier, disposable)); setupSupplierFactoryBridge(binding, builder); };
ServiceBindingBuilder<?> builder = binder.bindFactory(new InstanceSupplierFactoryBridge<>(supplier, disposable)); setupSupplierFactoryBridge(binding, builder); };
ServiceBindingBuilder<?> builder = binder.bindFactory( new SupplierFactoryBridge<>(locator, contract, binding.getName(), disposable)); setupSupplierFactoryBridge(binding, builder);
ServiceBindingBuilder<?> builder = binder.bindFactory( new SupplierFactoryBridge<>(locator, contract, binding.getName(), disposable)); setupSupplierFactoryBridge(binding, builder);
if (hkManaged) { optionalSingleton(singleton ? binder.bindFactory((Class<Factory<T>>) type, Singleton.class).to(type).to(res) : binder.bindFactory((Class<Factory<T>>) type).to(type).to(res), singleton); } else { binder.bindFactory(new LazyGuiceFactory(injector, type)).to(res); optionalSingleton(binder.bindFactory(new GuiceComponentFactory<>(injector, type)).to(type), singleton);
if (hkManaged) { optionalSingleton(singleton ? binder.bindFactory((Class<Factory<T>>) type, Singleton.class).to(type).to(res) : binder.bindFactory((Class<Factory<T>>) type).to(type).to(res), singleton); } else { binder.bindFactory(new LazyGuiceFactory(injector, type)).to(res); optionalSingleton(binder.bindFactory(new GuiceComponentFactory<>(injector, type)).to(type), singleton);
/** * Binds component into HK2 context. If component is annotated with {@link HK2Managed}, then registers type, * otherwise register guice "bridge" factory around component. * * @param binder HK2 binder * @param injector guice injector * @param type component type * @param hkManaged true if bean must be managed by HK2, false to bind guice managed instance * @param singleton true to force singleton scope * @see ru.vyarus.dropwizard.guice.module.jersey.support.GuiceComponentFactory */ public static void bindComponent(final AbstractBinder binder, final Injector injector, final Class<?> type, final boolean hkManaged, final boolean singleton) { if (hkManaged) { optionalSingleton( binder.bindAsContract(type), singleton); } else { // default case: simple service registered directly (including resource) optionalSingleton( binder.bindFactory(new GuiceComponentFactory<>(injector, type)).to(type), singleton); } }
/** * Binds component into HK2 context. If component is annotated with {@link HK2Managed}, then registers type, * otherwise register guice "bridge" factory around component. * * @param binder HK2 binder * @param injector guice injector * @param type component type * @param hkManaged true if bean must be managed by HK2, false to bind guice managed instance * @param singleton true to force singleton scope * @see ru.vyarus.dropwizard.guice.module.jersey.support.GuiceComponentFactory */ public static void bindComponent(final AbstractBinder binder, final Injector injector, final Class<?> type, final boolean hkManaged, final boolean singleton) { if (hkManaged) { optionalSingleton( binder.bindAsContract(type), singleton); } else { // default case: simple service registered directly (including resource) optionalSingleton( binder.bindFactory(new GuiceComponentFactory<>(injector, type)).to(type), singleton); } }
ServiceBindingBuilder<?> builder = binder.bindFactory(new InstanceSupplierFactoryBridge<>(supplier, disposable)); setupSupplierFactoryBridge(binding, builder); };
ServiceBindingBuilder<?> builder = binder.bindFactory(new InstanceSupplierFactoryBridge<>(supplier, disposable)); setupSupplierFactoryBridge(binding, builder); };
ServiceBindingBuilder<?> builder = binder.bindFactory( new SupplierFactoryBridge<>(locator, contract, binding.getName(), disposable)); setupSupplierFactoryBridge(binding, builder);
ServiceBindingBuilder<?> builder = binder.bindFactory( new SupplierFactoryBridge<>(locator, contract, binding.getName(), disposable)); setupSupplierFactoryBridge(binding, builder);
binder.bindFactory(new GuiceComponentFactory<>(injector, type)).to(type), singleton); optionalSingleton( } else { optionalSingleton( binder.bindFactory(new GuiceComponentFactory<>(injector, type)).to(type).to(bindingType), singleton);
binder.bindFactory(new GuiceComponentFactory<>(injector, type)).to(type), singleton); optionalSingleton( } else { optionalSingleton( binder.bindFactory(new GuiceComponentFactory<>(injector, type)).to(type).to(bindingType), singleton);