本文整理汇总了Java中com.soklet.util.InstanceProvider类的典型用法代码示例。如果您正苦于以下问题:Java InstanceProvider类的具体用法?Java InstanceProvider怎么用?Java InstanceProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InstanceProvider类属于com.soklet.util包,在下文中一共展示了InstanceProvider类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: provideInstanceProvider
import com.soklet.util.InstanceProvider; //导入依赖的package包/类
/**
* Provides an {@link InstanceProvider} which uses a <a href="https://github.com/google/guice">Guice</a>
* {@link Injector} to create instances.
*
* @param injector
* <a href="https://github.com/google/guice">Guice</a> {@link Injector} used to create instances
*
* @return an {@link InstanceProvider}
*/
@Inject
@Provides
@Singleton
public InstanceProvider provideInstanceProvider(Injector injector) {
return new InstanceProvider() {
@Override
public <T> T provide(Class<T> instanceClass) {
return injector.getInstance(instanceClass);
}
};
}
示例2: TomcatServer
import com.soklet.util.InstanceProvider; //导入依赖的package包/类
public TomcatServer(InstanceProvider instanceProvider) {
this.instanceProvider = requireNonNull(instanceProvider);
this.tomcat = new Tomcat();
}
示例3: DefaultRequestHandler
import com.soklet.util.InstanceProvider; //导入依赖的package包/类
public DefaultRequestHandler(InstanceProvider instanceProvider) {
this.instanceProvider = requireNonNull(instanceProvider);
this.valueConverterRegistry = new ValueConverterRegistry();
}
示例4: provideRequestHandler
import com.soklet.util.InstanceProvider; //导入依赖的package包/类
/**
* Provides a default {@link RequestHandler}.
*
* @param instanceProvider
* instance factory for objects that handle routes
* @return a {@link RequestHandler}
*/
@Inject
@Provides
@Singleton
public RequestHandler provideRequestHandler(InstanceProvider instanceProvider) {
return new DefaultRequestHandler(instanceProvider, new ValueConverterRegistry());
}