当前位置: 首页>>代码示例>>Java>>正文


Java Providers类代码示例

本文整理汇总了Java中com.google.inject.util.Providers的典型用法代码示例。如果您正苦于以下问题:Java Providers类的具体用法?Java Providers怎么用?Java Providers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Providers类属于com.google.inject.util包,在下文中一共展示了Providers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newIsisWicketModule

import com.google.inject.util.Providers; //导入依赖的package包/类
@Override
protected Module newIsisWicketModule() {
    final Module isisDefaults = super.newIsisWicketModule();
    
    final Module overrides = new AbstractModule() {
        @Override
        protected void configure() {
            bind(ComponentFactoryRegistrar.class).to(MyComponentFactoryRegistrar.class);

            bind(String.class).annotatedWith(Names.named("applicationName")).toInstance("RotaBuilder");
            bind(String.class).annotatedWith(Names.named("applicationCss")).toInstance("css/application.css");
            bind(String.class).annotatedWith(Names.named("applicationJs")).toInstance("scripts/application.js");
            bind(String.class).annotatedWith(Names.named("welcomeMessage")).toInstance(readLines(getClass(), "welcome.html"));
            bind(String.class).annotatedWith(Names.named("aboutMessage")).toInstance("RotaBuilder");
            bind(InputStream.class).annotatedWith(Names.named("metaInfManifest")).toProvider(
                    Providers.of(getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF")));
            // if uncommented, then overrides isis.appManifest in config file.
            // bind(AppManifest.class).toInstance(new DomainAppAppManifest());
        }
    };

    return Modules.override(isisDefaults).with(overrides);
}
 
开发者ID:bibryam,项目名称:rotabuilder,代码行数:24,代码来源:DomainApplication.java

示例2: newIsisWicketModule

import com.google.inject.util.Providers; //导入依赖的package包/类
@Override
 protected Module newIsisWicketModule() {
     final Module isisDefaults = super.newIsisWicketModule();
     
     final Module overrides = new AbstractModule() {
         @Override
         protected void configure() {
             bind(String.class).annotatedWith(Names.named("applicationName")).toInstance("SiGeSe");
             bind(String.class).annotatedWith(Names.named("applicationCss")).toInstance("css/application.css");
             bind(String.class).annotatedWith(Names.named("applicationJs")).toInstance("scripts/application.js");
	bind(String.class).annotatedWith(Names.named("brandLogoSignin")).toInstance("/about/images/login.png");
	bind(String.class).annotatedWith(Names.named("welcomeMessage")).toInstance(readLines(getClass(), "welcome.html"));
	bind(String.class).annotatedWith(Names.named("aboutMessage")).toInstance("SiGeSe");
	bind(InputStream.class).annotatedWith(Names.named("metaInfManifest")).toProvider(Providers.of(getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF")));
}
     };

     return Modules.override(isisDefaults).with(overrides);
 }
 
开发者ID:leandrogonqn,项目名称:Proyecto2017Seguros,代码行数:20,代码来源:PacinetesApplication.java

示例3: Formatter

import com.google.inject.util.Providers; //导入依赖的package包/类
Formatter(final String pattern) {
    final List<String> patterns = Splitter.on(VAR_BEGIN).omitEmptyStrings().splitToList(pattern);

    patterns.forEach(pt -> {
        if (!pt.contains(VAR_END)) {
            appenderList.add(Providers.of(pt));
        } else {
            StringTokenizer token = new StringTokenizer(pt, VAR_END);
            String guiceKey = token.nextToken();
            String rawString = null;
            if (token.hasMoreTokens()) {
                rawString = token.nextToken();
            }
            final KeyResolver resolver = new KeyResolver(guiceKey);
            appenderList.add(resolver);
            resolvers.add(resolver);
            appenderList.add(Providers.of(rawString));
        }
    });
}
 
开发者ID:syhily,项目名称:gossip,代码行数:21,代码来源:Formatter.java

示例4: newIsisWicketModule

import com.google.inject.util.Providers; //导入依赖的package包/类
@Override
protected Module newIsisWicketModule() {
    final Module isisDefaults = super.newIsisWicketModule();
    
    final Module overrides = new AbstractModule() {
        @Override
        protected void configure() {
            bind(String.class).annotatedWith(Names.named("applicationName")).toInstance("Food App");
            bind(String.class).annotatedWith(Names.named("applicationCss")).toInstance("css/application.css");
            bind(String.class).annotatedWith(Names.named("applicationJs")).toInstance("scripts/application.js");
            bind(String.class).annotatedWith(Names.named("welcomeMessage")).toInstance(readLines(getClass(), "welcome.html"));
            bind(String.class).annotatedWith(Names.named("aboutMessage")).toInstance("Food App");
            bind(InputStream.class).annotatedWith(Names.named("metaInfManifest")).toProvider(
                    Providers.of(getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF")));
            // if uncommented, then overrides isis.appManifest in config file.
            // bind(AppManifest.class).toInstance(new DomainAppAppManifest());
        }
    };

    return Modules.override(isisDefaults).with(overrides);
}
 
开发者ID:Stephen-Cameron-Data-Services,项目名称:isis-agri,代码行数:22,代码来源:DomainApplication.java

示例5: constructor_does_not_blow_up_if_metricsListener_is_null

import com.google.inject.util.Providers; //导入依赖的package包/类
@Test
public void constructor_does_not_blow_up_if_metricsListener_is_null() {
    // given
    AppServerConfig asc = new AppServerConfig(configForTesting) {
        @Override
        protected List<Module> getAppGuiceModules(Config appConfig) {
            return Arrays.asList(
                Modules.override(new AppGuiceModule(appConfig)).with(
                    binder -> binder
                        .bind(new TypeLiteral<CodahaleMetricsListener>() {})
                        .toProvider(Providers.of(null))),
                new BackstopperRiposteConfigGuiceModule()
            );
        }
    };

    // expect
    assertThat(asc.metricsListener()).isNull();
}
 
开发者ID:Nike-Inc,项目名称:riposte-microservice-template,代码行数:20,代码来源:AppServerConfigTest.java

示例6: newIsisWicketModule

import com.google.inject.util.Providers; //导入依赖的package包/类
@Override
    protected Module newIsisWicketModule() {
        final Module isisDefaults = super.newIsisWicketModule();
        
        final Module overrides = new AbstractModule() {
            @Override
            protected void configure() {

                bind(String.class).annotatedWith(Names.named("applicationName")).toInstance("ECP CRM");
                bind(String.class).annotatedWith(Names.named("applicationCss")).toInstance("css/application.css");
                bind(String.class).annotatedWith(Names.named("applicationJs")).toInstance("scripts/application.js");
//                bind(String.class).annotatedWith(Names.named("brandLogoHeader")).toInstance("/images/domainapp-logo-header.png");
//                bind(String.class).annotatedWith(Names.named("brandLogoSignin")).toInstance("/images/domainapp-logo-signin.png");
                bind(String.class).annotatedWith(Names.named("welcomeMessage")).toInstance(readLines(getClass(), "welcome.html"));
                bind(String.class).annotatedWith(Names.named("aboutMessage")).toInstance("ECP CRM");
                bind(InputStream.class).annotatedWith(Names.named("metaInfManifest")).toProvider(Providers.of(getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF")));
            }
        };

        return Modules.override(isisDefaults).with(overrides);
    }
 
开发者ID:incodehq,项目名称:ecpcrm,代码行数:22,代码来源:EcpCrmApplication.java

示例7: configurePersistence

import com.google.inject.util.Providers; //导入依赖的package包/类
protected void configurePersistence() {
	bind(String[].class).annotatedWith(Neo4j.class).toInstance(packages);

	if (null != properties) {
		bind(Properties.class).annotatedWith(Neo4j.class).toInstance(properties);
	} else {
		bind(Properties.class).annotatedWith(Neo4j.class).toProvider(Providers.of(null));
	}

	bind(Neo4jPersistService.class).in(Singleton.class);
	bind(PersistService.class).to(Neo4jPersistService.class);
	bind(UnitOfWork.class).to(Neo4jPersistService.class);
	bind(Session.class).toProvider(Neo4jPersistService.class);

	transactionInterceptor = new Neo4jLocalTxnInterceptor();
	requestInjection(transactionInterceptor);
}
 
开发者ID:mangrish,项目名称:guice-persist-neo4j,代码行数:18,代码来源:Neo4jPersistModule.java

示例8: testGuicify330Provider

import com.google.inject.util.Providers; //导入依赖的package包/类
public void testGuicify330Provider() {
    Provider<String> jsr330Provider = new Provider<String>() {
        @Override
        public String get() {
            return "A";
        }

        @Override
        public String toString() {
            return "jsr330Provider";
        }
    };

    com.google.inject.Provider<String> guicified = Providers
            .guicify(jsr330Provider);
    assertEquals("guicified(jsr330Provider)", guicified.toString());
    assertEquals("A", guicified.get());

    // when you guicify the Guice-friendly, it's a no-op
    assertSame(guicified, Providers.guicify(guicified));

}
 
开发者ID:ruediste,项目名称:salta,代码行数:23,代码来源:Jsr330Test.java

示例9: testBindToInjectorWithListeningGivesSaneException

import com.google.inject.util.Providers; //导入依赖的package包/类
public void testBindToInjectorWithListeningGivesSaneException() {
    try {
        Guice.createInjector(new AbstractModule() {
            @Override
            protected void configure() {
                bindListener(Matchers.any(), new Counter());
                bind(Injector.class)
                        .toProvider(Providers.<Injector> of(null));
            }
        });
        fail();
    } catch (SaltaException ce) {
        assertContains(ce.getMessage(),
                "Binding to core guice framework type is not allowed: Injector.");
    }
}
 
开发者ID:ruediste,项目名称:salta,代码行数:17,代码来源:ProvisionListenerTest.java

示例10: testBindingToProvider

import com.google.inject.util.Providers; //导入依赖的package包/类
@Test
public void testBindingToProvider() {
    try {
        Guice.createInjector(new AbstractModule() {
            @Override
            protected void configure() {
                bind(new TypeLiteral<Provider<String>>() {
                }).toInstance(Providers.of("A"));
            }
        });
        fail();
    } catch (SaltaException expected) {
        assertContains(expected.getMessage(),
                "Binding to core guice framework type is not allowed: Provider.");
    }
}
 
开发者ID:ruediste,项目名称:salta,代码行数:17,代码来源:BinderTest.java

示例11: configure

import com.google.inject.util.Providers; //导入依赖的package包/类
@Override
protected void configure() {
    bind(AbstractModule.class).annotatedWith(red)
            .toProvider(Providers.<AbstractModule> of(null));
    bind(Binder.class).annotatedWith(red)
            .toProvider(Providers.<Binder> of(null));
    bind(Binding.class).annotatedWith(red)
            .toProvider(Providers.<Binding> of(null));
    bind(Injector.class).annotatedWith(red)
            .toProvider(Providers.<Injector> of(null));
    bind(Key.class).annotatedWith(red)
            .toProvider(Providers.<Key> of(null));
    bind(Module.class).annotatedWith(red)
            .toProvider(Providers.<Module> of(null));
    bind(Provider.class).annotatedWith(red)
            .toProvider(Providers.<Provider> of(null));
    bind(Scope.class).annotatedWith(red)
            .toProvider(Providers.<Scope> of(null));
    bind(Stage.class).annotatedWith(red)
            .toProvider(Providers.<Stage> of(null));
    bind(TypeLiteral.class).annotatedWith(red)
            .toProvider(Providers.<TypeLiteral> of(null));
    bind(new TypeLiteral<Key<String>>() {
    }).toProvider(Providers.<Key<String>> of(null));
}
 
开发者ID:ruediste,项目名称:salta,代码行数:26,代码来源:BinderTest.java

示例12: configure

import com.google.inject.util.Providers; //导入依赖的package包/类
@Override protected void configure() {
  bind(CliConfiguration.class).toInstance(config);

  bind(JCommander.class).annotatedWith(Names.named("ParentCommander"))
      .toInstance(parentCommander);

  if (commander == null) {
    bind(JCommander.class).annotatedWith(Names.named("Commander"))
        .toProvider(Providers.of((JCommander) null));
    bind(String.class).annotatedWith(Names.named("Command"))
        .toProvider(Providers.of((String) null));
  } else {
    bind(JCommander.class).annotatedWith(Names.named("Commander")).toInstance(commander);
    bindConstant().annotatedWith(Names.named("Command")).to(command);
  }

  bind(Map.class).annotatedWith(Names.named("CommandMap")).toInstance(commands);
}
 
开发者ID:square,项目名称:keywhiz,代码行数:19,代码来源:CliModule.java

示例13: newIsisWicketModule

import com.google.inject.util.Providers; //导入依赖的package包/类
@Override
protected Module newIsisWicketModule() {
    final Module isisDefaults = super.newIsisWicketModule();
    
    final Module overrides = new AbstractModule() {
        @Override
        protected void configure() {

            bind(String.class).annotatedWith(Names.named("applicationName")).toInstance("Domain App");
            bind(String.class).annotatedWith(Names.named("applicationCss")).toInstance("css/application.css");
            bind(String.class).annotatedWith(Names.named("applicationJs")).toInstance("scripts/application.js");
            bind(String.class).annotatedWith(Names.named("brandLogoHeader")).toInstance("/images/domainapp-logo-header.png");
            bind(String.class).annotatedWith(Names.named("brandLogoSignin")).toInstance("/images/domainapp-logo-signin.png");
            bind(String.class).annotatedWith(Names.named("welcomeMessage")).toInstance(readLines(getClass(), "welcome.html"));
            bind(String.class).annotatedWith(Names.named("aboutMessage")).toInstance("Domain App");
            bind(InputStream.class).annotatedWith(Names.named("metaInfManifest")).toProvider(Providers.of(getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF")));
        }
    };

    return Modules.override(isisDefaults).with(overrides);
}
 
开发者ID:isisaddons-legacy,项目名称:isis-app-quickstart,代码行数:22,代码来源:DomainApplication.java

示例14: newIsisWicketModule

import com.google.inject.util.Providers; //导入依赖的package包/类
@Override
protected Module newIsisWicketModule() {
    final Module isisDefaults = super.newIsisWicketModule();
    
    final Module overrides = new AbstractModule() {
        @Override
        protected void configure() {
            bind(String.class).annotatedWith(Names.named("applicationName")).toInstance("Simple App");
            bind(String.class).annotatedWith(Names.named("applicationCss")).toInstance("css/application.css");
            bind(String.class).annotatedWith(Names.named("applicationJs")).toInstance("scripts/application.js");
            bind(String.class).annotatedWith(Names.named("welcomeMessage")).toInstance(readLines(getClass(), "welcome.html"));
            bind(String.class).annotatedWith(Names.named("aboutMessage")).toInstance("Simple App");
            bind(InputStream.class).annotatedWith(Names.named("metaInfManifest")).toProvider(
                    Providers.of(getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF")));
            // if uncommented, then overrides isis.appManifest in config file.
            // bind(AppManifest.class).toInstance(new DomainAppAppManifest());
        }
    };

    return Modules.override(isisDefaults).with(overrides);
}
 
开发者ID:isisaddons,项目名称:isis-app-simpledsl,代码行数:22,代码来源:DomainApplication.java

示例15: newIsisWicketModule

import com.google.inject.util.Providers; //导入依赖的package包/类
@Override
protected Module newIsisWicketModule() {
    final Module isisDefaults = super.newIsisWicketModule();
    
    final Module overrides = new AbstractModule() {
        @Override
        protected void configure() {
            bind(String.class).annotatedWith(Names.named("applicationName")).toInstance(" Mejorar ");
            bind(String.class).annotatedWith(Names.named("applicationCss")).toInstance("css/application.css");
            bind(String.class).annotatedWith(Names.named("applicationJs")).toInstance("scripts/application.js");
            bind(String.class).annotatedWith(Names.named("welcomeMessage")).toInstance(readLines(getClass(), "welcome.html"));
            bind(String.class).annotatedWith(Names.named("aboutMessage")).toInstance(" Mejorar ");
            bind(InputStream.class).annotatedWith(Names.named("metaInfManifest")).toProvider(Providers.of(getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF")));
        }
    };

    return Modules.override(isisDefaults).with(overrides);
}
 
开发者ID:TesisTarjetasMejorar,项目名称:TarjetasISIS,代码行数:19,代码来源:SimpleApplication.java


注:本文中的com.google.inject.util.Providers类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。