本文整理了Java中com.google.inject.Provider.get()
方法的一些代码示例,展示了Provider.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Provider.get()
方法的具体详情如下:
包路径:com.google.inject.Provider
类名称:Provider
方法名:get
[英]Provides an instance of T. Must never return null.
[中]提供T的实例。不得返回null。
代码示例来源:origin: ninjaframework/ninja
@Override
public void service(ServletRequest req,
ServletResponse resp
) throws IOException,
ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
ServletContext servletContext = getServletContext();
// We generate a Ninja compatible context element
NinjaServletContext context = (NinjaServletContext) injector.getProvider(Context.class)
.get();
// And populate it
context.init(servletContext, request, response);
// And invoke ninja on it.
// Ninja handles all defined routes, filters and much more:
ninja.onRouteRequest(context);
}
}
代码示例来源:origin: net.thucydides/thucydides-core
public EnvironmentVariables getEnvironmentVariables() {
if (environmentVariables == null) {
environmentVariables = Injectors.getInjector().getProvider(EnvironmentVariables.class).get() ;
}
return environmentVariables;
}
代码示例来源:origin: net.serenity-bdd/core
public Photographer(final WebDriver driver,
final File targetDirectory,
final ScreenshotProcessor screenshotProcessor,
BlurLevel blurLevel) {
this(driver, targetDirectory, screenshotProcessor, blurLevel,
Injectors.getInjector().getProvider(EnvironmentVariables.class).get() );
}
代码示例来源:origin: apache/incubator-druid
throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, IOException
JsonConfigurator configurator = injector.getBinding(JsonConfigurator.class).getProvider().get();
Assert.assertEquals(propertyValues.size(), assertions);
ObjectMapper jsonMapper = injector.getProvider(Key.get(ObjectMapper.class, Json.class)).get();
String jsonVersion = jsonMapper.writeValueAsString(zkPathsConfigObj);
代码示例来源:origin: net.thucydides/thucydides-core
public Photographer(final WebDriver driver,
final File targetDirectory,
final ScreenshotProcessor screenshotProcessor,
BlurLevel blurLevel) {
this(driver, targetDirectory, screenshotProcessor, blurLevel,
Injectors.getInjector().getProvider(EnvironmentVariables.class).get() );
}
代码示例来源:origin: locationtech/geogig
private <T> T getInstance(final Class<T> type) {
checkNotNull(type);
Provider<T> provider = guiceInjector.getProvider(type);
T instance = provider.get();
return instance;
}
代码示例来源:origin: net.thucydides/thucydides-core
protected TestOutcomes(List<? extends TestOutcome> outcomes,
double estimatedAverageStepCount,
String label) {
this(outcomes, estimatedAverageStepCount, label, null, Injectors.getInjector().getProvider(EnvironmentVariables.class).get() );
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
private <T> T getInstance(final Class<T> type) {
checkNotNull(type);
Provider<T> provider = guiceInjector.getProvider(type);
T instance = provider.get();
return instance;
}
代码示例来源:origin: net.serenity-bdd/core
public EnvironmentVariables getEnvironmentVariables() {
if (environmentVariables == null) {
environmentVariables = Injectors.getInjector().getProvider(EnvironmentVariables.class).get() ;
}
return environmentVariables;
}
代码示例来源:origin: mycila/guice
@Override
public void handle(TypeLiteral<?> type, Object instance, Method method, PostConstruct annotation) {
if (!Modifier.isStatic(method.getModifiers())) {
List<Key<?>> parameterKeys = Reflect.getParameterKeys(type, method);
Object[] parameters = new Object[parameterKeys.size()];
for (int i = 0; i < parameters.length; i++)
parameters[i] = injector.get().getProvider(parameterKeys.get(i)).get();
MethodInvoker.on(method).invoke(instance, parameters);
}
}
代码示例来源:origin: net.serenity-bdd/serenity-model
protected TestOutcomes(List<? extends TestOutcome> outcomes,
double estimatedAverageStepCount,
String label,
TestResult resultFilter) {
this(outcomes, estimatedAverageStepCount, label, null, resultFilter, null, Injectors.getInjector().getProvider(EnvironmentVariables.class).get() );
}
代码示例来源:origin: mycila/guice
@Override
public void handle(TypeLiteral<?> type, Object instance, Method method, PostConstruct annotation) {
if (!Modifier.isStatic(method.getModifiers())) {
List<Key<?>> parameterKeys = Reflect.getParameterKeys(type, method);
Object[] parameters = new Object[parameterKeys.size()];
for (int i = 0; i < parameters.length; i++)
parameters[i] = injector.get().getProvider(parameterKeys.get(i)).get();
MethodInvoker.on(method).invoke(instance, parameters);
}
}
代码示例来源:origin: net.thucydides.maven.plugins/maven-thucydides-plugin
private EnvironmentVariables getEnvironmentVariables() {
if (environmentVariables == null) {
environmentVariables = Injectors.getInjector().getProvider(EnvironmentVariables.class).get() ;
}
return environmentVariables;
}
代码示例来源:origin: com.fizzed/ninja-undertow
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
// create Ninja compatible context element
NinjaUndertowContext undertowContext
= (NinjaUndertowContext)injector.getProvider(Context.class).get();
// initialize it
undertowContext.init(exchange, context);
// invoke ninja on it
ninja.onRouteRequest(undertowContext);
}
代码示例来源:origin: net.serenity-bdd/serenity-model
public MultipleSourceRequirmentsOutcomeFactory(List<RequirementsTagProvider> requirementsTagProviders,
IssueTracking issueTracking,
ReportNameProvider reportNameProvider) {
this(requirementsTagProviders, issueTracking, Injectors.getInjector().getProvider(EnvironmentVariables.class).get(), reportNameProvider);
}
代码示例来源:origin: net.thucydides.plugins.jira/thucydides-jira-plugin
public JiraListener() {
this(Injectors.getInjector().getInstance(IssueTracker.class),
Injectors.getInjector().getProvider(EnvironmentVariables.class).get() ,
Injectors.getInjector().getInstance(WorkflowLoader.class));
}
代码示例来源:origin: net.serenity-bdd/core
protected TestOutcomes(List<? extends TestOutcome> outcomes,
double estimatedAverageStepCount,
String label) {
this(outcomes, estimatedAverageStepCount, label, null, Injectors.getInjector().getProvider(EnvironmentVariables.class).get() );
}
代码示例来源:origin: net.serenity-bdd/serenity-jira-plugin
public JiraFileServiceUpdater() {
this(Injectors.getInjector().getInstance(IssueTracker.class),
Injectors.getInjector().getProvider(EnvironmentVariables.class).get() ,
Injectors.getInjector().getInstance(WorkflowLoader.class));
}
代码示例来源:origin: net.serenity-bdd/serenity-model
protected TestOutcomes(List<? extends TestOutcome> outcomes,
double estimatedAverageStepCount,
String label,
TestTag tag) {
this(outcomes, estimatedAverageStepCount, label, tag, null, null, Injectors.getInjector().getProvider(EnvironmentVariables.class).get() );
}
代码示例来源:origin: net.serenity-bdd/serenity-jira-plugin
public JiraStepListener() {
this(Injectors.getInjector().getInstance(IssueTracker.class),
Injectors.getInjector().getProvider(EnvironmentVariables.class).get() ,
Injectors.getInjector().getInstance(WorkflowLoader.class),
Injectors.getInjector().getInstance(ZephyrClient.class));
}
内容来源于网络,如有侵权,请联系作者删除!