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


Java Binder.install方法代码示例

本文整理汇总了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()));
        }
    });
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:25,代码来源:TypeMapBinder.java

示例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));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:10,代码来源:ImgTemplateParserJUnitTest.java

示例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));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:9,代码来源:FeatureBinder.java

示例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));
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:41,代码来源:ProjectModule.java

示例5: configure

import com.google.inject.Binder; //导入方法依赖的package包/类
@Override
public void configure(Binder binder) {
    binder.install(new FactoryModuleBuilder().build(MediaWrapperFactory.class));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:5,代码来源:HTML5VideoMediaWrapperJUnitTest.java

示例6: configure

import com.google.inject.Binder; //导入方法依赖的package包/类
@Override
public void configure(Binder binder) {
    binder.install(new FactoryModuleBuilder().build(MediaWrappersPairFactory.class));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:5,代码来源:MediaWrappersPairTest.java

示例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()));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:6,代码来源:ConnectionItemsJUnitTest.java

示例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()));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:6,代码来源:HTML5MediaExecutorFactoryJUnitTest.java

示例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());
}
 
开发者ID:airlift,项目名称:drift,代码行数:6,代码来源:DriftClientBinder.java


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