Package com.google.inject

Examples of com.google.inject.PrivateModule


  public Module getDistributedModules() {
    return getCommonModules();
  }

  private Module getCommonModules() {
    return new PrivateModule() {
      @Override
      protected void configure() {
        install(new GatewayCommonHandlerModule());

        bind(Gateway.class);
View Full Code Here


        Module module = new Module()
        {
            @Override
            public void configure(Binder binder)
            {
                final PrivateModule privateModule = new PrivateModule()
                {
                    @Override
                    protected void configure()
                    {
                        binder().bind(SimpleBase.class).to(SimpleBaseImpl.class).in(Scopes.SINGLETON);
View Full Code Here

        protected void configure()
        {
            requireBinding( CachingModuleTest.class );
            getMembersInjector( CachingModuleTest.class );

            install( new PrivateModule()
            {
                @Override
                protected void configure()
                {
                    requireBinding( CachingModuleTest.class );
View Full Code Here

    }

    @Override
    public void configure( final Binder binder )
    {
        binder.install( new PrivateModule()
        {
            @Override
            protected void configure()
            {
                bind( Foo.class ).to( PrivateFoo.class );
                bindConstant().annotatedWith( Names.named( "port" ) ).to( 8081 );
                expose( Foo.class );
            }
        } );

        binder.install( new PrivateModule()
        {
            @Override
            protected void configure()
            {
                bind( Foo.class ).annotatedWith( Names.named( "A" ) ).to( PrivateFoo.class );
                bindConstant().annotatedWith( Names.named( "port" ) ).to( 1234 );
                expose( Foo.class ).annotatedWith( Names.named( "A" ) );
            }
        } );

        binder.install( new PrivateModule()
        {
            @Override
            protected void configure()
            {
                bind( Foo.class ).annotatedWith( Names.named( "B" ) ).to( PrivateFoo.class );
View Full Code Here

                bind( Bean.class ).annotatedWith( Names.named( "instance" ) ).toInstance( new BeanImpl() );

                bind( Bean.class ).annotatedWith( Names.named( "deferred" ) ).toProvider( new LoadedClass<Bean>(
                                                                                                                 BeanImpl.class ) );

                install( new PrivateModule()
                {
                    @Override
                    protected void configure()
                    {
                        bind( Bean.class ).annotatedWith( Names.named( "exposed" ) ).to( BeanImpl.class );
View Full Code Here

        Module module = new Module()
        {
            @Override
            public void configure(Binder binder)
            {
                final PrivateModule privateModule = new PrivateModule()
                {
                    @Override
                    protected void configure()
                    {
                        binder().bind(SimpleBase.class).to(SimpleBaseImpl.class).in(Scopes.SINGLETON);
View Full Code Here

      }
    );
  }

  private Module createProgramFactoryModule() {
    return new PrivateModule() {
      @Override
      protected void configure() {
        bind(LocationFactory.class)
          .annotatedWith(Names.named("program.location.factory"))
          .toInstance(new LocalLocationFactory(new File(System.getProperty("user.dir"))));
View Full Code Here

    this.executor = Objects.requireNonNull(executor);
  }

  @Override
  protected void configure() {
    install(new PrivateModule() {
      @Override
      protected void configure() {
        bind(ScheduledExecutorService.class).toInstance(executor);
        bind(UpdateFactory.class).to(UpdateFactory.UpdateFactoryImpl.class);
        bind(UpdateFactory.UpdateFactoryImpl.class).in(Singleton.class);
View Full Code Here

   *
   * @param storageClass Non-volatile storage implementation class.
   * @return Binding module.
   */
  public static Module wrappingModule(final Class<? extends NonVolatileStorage> storageClass) {
    return new PrivateModule() {
      @Override
      protected void configure() {
        bind(Storage.class).to(CallOrderEnforcingStorage.class);
        bind(NonVolatileStorage.class).to(CallOrderEnforcingStorage.class);
        bind(CallOrderEnforcingStorage.class).in(Singleton.class);
View Full Code Here

  @Override
  protected void configure() {
    bind(TaskIdGenerator.class).to(TaskIdGeneratorImpl.class);
    bind(UserTaskLauncher.class).in(Singleton.class);

    install(new PrivateModule() {
      @Override
      protected void configure() {
        bind(LeadingOptions.class).toInstance(
            new LeadingOptions(MAX_REGISTRATION_DELAY.get(), MAX_LEADING_DURATION.get()));
View Full Code Here

TOP

Related Classes of com.google.inject.PrivateModule

Copyright © 2018 www.massapicom. 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.