本文整理汇总了Java中com.google.inject.Binder.install方法的典型用法代码示例。如果您正苦于以下问题:Java Binder.install方法的具体用法?Java Binder.install怎么用?Java Binder.install使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.inject.Binder
的用法示例。
在下文中一共展示了Binder.install方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TypeMapBinder
import com.google.inject.Binder; //导入方法依赖的package包/类
public TypeMapBinder(Binder binder, @Nullable TypeLiteral<K> keyType, @Nullable TypeLiteral<V> valueType) {
this.keyType = keyType != null ? keyType : new ResolvableType<K>(){}.in(getClass());
this.valueType = valueType != null ? valueType : new ResolvableType<V>(){}.in(getClass());
final TypeArgument<K> keyTypeArg = new TypeArgument<K>(this.keyType){};
final TypeArgument<V> valueTypeArg = new TypeArgument<V>(this.valueType){};
this.collectionKey = Key.get(new ResolvableType<TypeMap<K, V>>(){}.with(keyTypeArg, valueTypeArg));
this.backingCollectionKey = Key.get(new ResolvableType<Map<TypeToken<? extends K>, Set<V>>>(){}.with(keyTypeArg, valueTypeArg));
this.backingCollectionBinder = MapBinder.newMapBinder(
binder,
new ResolvableType<TypeToken<? extends K>>(){}.with(keyTypeArg),
this.valueType
).permitDuplicates();
binder.install(new KeyedManifest.Impl(collectionKey) {
@Override
public void configure() {
final Provider<Map<TypeToken<? extends K>, Set<V>>> backingCollectionProvider = getProvider(backingCollectionKey);
bind(collectionType()).toProvider(() -> ImmutableTypeMap.copyOf(backingCollectionProvider.get()));
}
});
}
示例2: configure
import com.google.inject.Binder; //导入方法依赖的package包/类
@Override
public void configure(Binder binder) {
binder.bind(ModuleWrapper.class).toInstance(mock(ModuleWrapper.class));
binder.install(new FactoryModuleBuilder().build(TemplateParserFactory.class));
binder.bind(PicturePlayerView.class).to(PicturePlayerViewImpl.class);
binder.bind(PicturePlayerJAXBParser.class).to(PicturePlayerJAXBParserMock.class);
binder.bind(ExplorableImgContentView.class).to(ExplorableImgContentViewImpl.class);
binder.install(new FactoryModuleBuilder().build(TouchHandlerFactory.class));
}
示例3: FeatureBinder
import com.google.inject.Binder; //导入方法依赖的package包/类
public FeatureBinder(Binder binder, @Nullable TypeLiteral<T> type) {
this.binder = binder;
this.type = type != null ? type : new ResolvableType<T>(){}.in(getClass());
this.typeArg = new TypeArgument<T>(this.type){};
this.key = Key.get(this.type);
binder.install(new FeatureManifest<>(this.type));
}
示例4: configure
import com.google.inject.Binder; //导入方法依赖的package包/类
@Override
public void configure(@Nonnull Binder binder) {
binder.bind(Project.class)
.toInstance(project);
// Binding InputValidator related classes
binder.bind(InputValidator.class)
.annotatedWith(Name.NAME_VALIDATOR.annotation())
.to(NameValidator.class);
binder.bind(InputValidator.class)
.annotatedWith(Name.JSON_VALIDATOR.annotation())
.to(JsonValidator.class);
binder.bind(InputValidator.class)
.annotatedWith(Name.CLASS_PREFIX_VALIDATOR.annotation())
.to(ClassPrefixValidator.class);
binder.bind(InputValidator.class)
.annotatedWith(Name.CLASS_SUFFIX_VALIDATOR.annotation())
.to(ClassSuffixValidator.class);
// Binding NamePolicy classes
binder.bind(NamePolicy.class)
.annotatedWith(Name.CLASS_NAME_POLICY.annotation())
.to(ClassNamePolicy.class);
binder.bind(NamePolicy.class)
.annotatedWith(Name.FIELD_NAME_POLICY.annotation())
.to(FieldNamePolicy.class);
binder.bind(NamePolicy.class)
.annotatedWith(Name.METHOD_NAME_POLICY.annotation())
.to(MethodNamePolicy.class);
binder.bind(NamePolicy.class)
.annotatedWith(Name.PARAMETER_NAME_POLICY.annotation())
.to(ParameterNamePolicy.class);
// Binding other classes
binder.bind(Json2JavaBundle.class)
.toInstance(Json2JavaBundle.getInstance());
// Installation factory modules
binder.install(new FactoryModuleBuilder().build(CommandActionFactory.class));
}
示例5: configure
import com.google.inject.Binder; //导入方法依赖的package包/类
@Override
public void configure(Binder binder) {
binder.install(new FactoryModuleBuilder().build(MediaWrapperFactory.class));
}
示例6: configure
import com.google.inject.Binder; //导入方法依赖的package包/类
@Override
public void configure(Binder binder) {
binder.install(new FactoryModuleBuilder().build(MediaWrappersPairFactory.class));
}
示例7: configure
import com.google.inject.Binder; //导入方法依赖的package包/类
@Override
public void configure(Binder binder) {
binder.install(new FactoryModuleBuilder().build(ConnectionItemsFactory.class));
binder.bind(ConnectionModuleFactory.class).toInstance(spy(new ConnectionModuleFactoryMock()));
}
示例8: configure
import com.google.inject.Binder; //导入方法依赖的package包/类
@Override
public void configure(Binder binder) {
binder.install(new FactoryModuleBuilder().build(MediaWrapperFactory.class));
binder.bind(HTML5MediaWrapperFactory.class).toInstance(spy(new HTML5MediaWrapperFactory()));
}
示例9: DriftClientBinder
import com.google.inject.Binder; //导入方法依赖的package包/类
private DriftClientBinder(Binder binder)
{
this.binder = requireNonNull(binder, "binder is null").skipSources(this.getClass());
binder.install(new DriftClientBinderModule());
}