當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。