Examples of AbstractBinder


Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

            return Sets.<Class<?>>newHashSet(Resource.class, MyFilter.class, MyWriter.class, MyContainerLifecycleListener.class);
        }

        @Override
        public Set<Object> getSingletons() {
            return Sets.<Object>newHashSet(new AbstractBinder() {
                @Override
                protected void configure() {
                    bindFactory(SingletonFactory.class)
                            .to(SingletonInstance.class)
                            .in(Singleton.class);
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

    }

    @Override
    protected Application configure() {
        final ResourceConfig resourceConfig = new ResourceConfig(TestResource.class);
        resourceConfig.register(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(new MyInjectedService("hello")).to(MyInjectedService.class);
            }
        });
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

        register(AppScopedFieldInjectedResource.class);
        register(AppScopedCtorInjectedResource.class);
        register(RequestScopedFieldInjectedResource.class);
        register(RequestScopedCtorInjectedResource.class);

        register(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(new MyInjection("1st: unused HK2 binding")).to(MyInjection.class);
                bind(new CdiInjectedType("2nd: unused HK2 binding")).to(CdiInjectedType.class);
            }
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

    @Test
    public void testFeatureInjections() throws Exception {
        config.register(InjectIntoFeatureClass.class)
                .register(new InjectIntoFeatureInstance())
                .register(new AbstractBinder() {
                    @Override
                    protected void configure() {
                        bind(new InjectMe());
                    }
                });
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

public class SourceProviderTest {
    private ServiceLocator locator;

    @Before
    public void setUp() {
        locator = SaxParserFactoryInjectionProviderTest.createServiceLocator(new AbstractBinder() {
            @Override
            protected void configure() {
                bindAsContract(SourceProvider.SaxSourceReader.class);
            }
        });
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

            // Configure binders and features.
            runtimeCfgState.configureMetaProviders(locator);

            // Bind configuration.
            final AbstractBinder configBinder = new AbstractBinder() {
                @Override
                protected void configure() {
                    bind(runtimeCfgState).to(Configuration.class);
                }
            };
            final DynamicConfiguration dc = Injections.getConfiguration(locator);
            configBinder.bind(dc);
            dc.commit();

            // Bind providers.
            ProviderBinder.bindProviders(runtimeCfgState.getComponentBag(), RuntimeType.CLIENT, null, locator);
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

public class RequestScopeTest extends JerseyTest {

    @Override
    protected Application configure() {
        return new ResourceConfig(RemoveResource.class)
                .register(new AbstractBinder() {
                    @Override
                    protected void configure() {
                        bindFactory(CloseMeFactory.class, RequestScoped.class).to(CloseMe.class).in(RequestScoped.class);
                    }
                });
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

    }

    @Test
    public void testFeatureInstance() {
        final Response response = target().path("resource")
                .register(new AbstractBinder() {
                    @Override
                    protected void configure() {
                        bind(new MyInjectedService("feature")).to(MyInjectedService.class);
                    }
                })
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

    }

    @Test
    public void testFeatureClass() {
        final Response response = target().path("resource")
                .register(new AbstractBinder() {
                    @Override
                    protected void configure() {
                        bind(new MyInjectedService("feature")).to(MyInjectedService.class);
                    }
                })
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

        public void dispose(Ref<Subject> t) {
        }
    }

    protected Set<? extends Binder> getAdditionalBinders(){
        return Collections.singleton(new AbstractBinder() {
            @Override
            protected void configure() {
                bindFactory(SubjectReferenceFactory.class).to(new TypeLiteral<Ref<Subject>>() {
                }).in(PerLookup.class);
                bindFactory(ReferencingFactory.<Subject>referenceFactory()).to(new TypeLiteral<Ref<Subject>>() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.