com.google.inject.multibindings.MapBinder Java Examples

The following examples show how to use com.google.inject.multibindings.MapBinder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EnvironmentModule.java    From presto with Apache License 2.0 6 votes vote down vote up
@Override
public void configure(Binder binder)
{
    binder.bind(PortBinder.class);
    binder.bind(EnvironmentFactory.class);
    binder.bind(Standard.class);
    binder.bind(Hadoop.class);
    binder.bind(Kerberos.class);
    binder.bind(KerberosKms.class);
    binder.bind(Kafka.class);

    MapBinder<String, EnvironmentProvider> environments = newMapBinder(binder, String.class, EnvironmentProvider.class);

    Environments.findByBasePackage(BASE_PACKAGE).forEach(clazz -> environments.addBinding(Environments.nameForClass(clazz)).to(clazz));

    binder.install(additionalEnvironments);
}
 
Example #2
Source File: AdapterInjectorTests.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Tests that a warning message is given when the actual type of an adapter
 * could be precisely inferred from the binding, and the binding provides a
 * type key as well.
 */
@Test
public void ensureSuperfluousKeyDetected() throws Exception {
	Module module = new AbstractModule() {
		@Override
		protected void configure() {
			install(new AdapterInjectionSupport());

			// create map bindings for AdapterStore, which is an IAdaptable
			MapBinder<AdapterKey<?>, Object> adapterMapBinder = AdapterMaps
					.getAdapterMapBinder(binder(), AdapterStore.class);
			// use raw type as key and target
			adapterMapBinder.addBinding(AdapterKey.get(RawType.class))
					.to(RawType.class);
		}
	};

	AdapterStore adaptable = new AdapterStore();
	List<String> issues = performInjection(adaptable, module);
	assertEquals(1, issues.size());
	// System.out.println(issues.get(0));
	assertTrue(issues.get(0).contains("INFO"));
	assertTrue(issues.get(0).contains(
			"The redundant type key org.eclipse.gef.common.tests.AdapterInjectorTests$RawType may be omitted in the adapter key of the binding, using AdapterKey.defaultRole() instead."));
}
 
Example #3
Source File: CompilerModule.java    From protostuff-compiler with Apache License 2.0 6 votes vote down vote up
@Override
protected void configure() {
    bind(CompilerRegistry.class);
    bind(CompilerUtils.class);
    bind(MarkdownProcessor.class).to(PegDownMarkdownProcessor.class).in(Scopes.SINGLETON);
    install(new FactoryModuleBuilder()
            .implement(ProtoCompiler.class, StCompiler.class)
            .build(StCompilerFactory.class));
    install(new FactoryModuleBuilder()
            .implement(ProtoCompiler.class, ExtensibleStCompiler.class)
            .build(ExtensibleStCompilerFactory.class));
    Multibinder<HtmlCompiler> htmlCompilerBinder = Multibinder.newSetBinder(binder(), HtmlCompiler.class);
    htmlCompilerBinder.addBinding().to(JsonIndexGenerator.class);
    htmlCompilerBinder.addBinding().to(JsonEnumGenerator.class);
    htmlCompilerBinder.addBinding().to(JsonMessageGenerator.class);
    htmlCompilerBinder.addBinding().to(JsonServiceGenerator.class);
    htmlCompilerBinder.addBinding().to(JsonProtoGenerator.class);
    htmlCompilerBinder.addBinding().to(JsonPagesIndexGenerator.class);
    htmlCompilerBinder.addBinding().to(JsonPageGenerator.class);
    MapBinder<String, ProtoCompiler> compilers = newMapBinder(binder(), String.class, ProtoCompiler.class);
    compilers.addBinding(HTML_COMPILER).to(HtmlGenerator.class);
    compilers.addBinding(JAVA_COMPILER).toProvider(JavaCompilerProvider.class);
    compilers.addBinding(ST4_COMPILER).toProvider(St4CompilerProvider.class);
    compilers.addBinding(DUMMY_COMPILER).to(DummyGenerator.class).in(Scopes.SINGLETON);
}
 
Example #4
Source File: SemanticParserModule.java    From EDDI with Apache License 2.0 6 votes vote down vote up
private void initDictionaryPlugins() {
    MapBinder<String, IDictionaryProvider> parserDictionaryPlugins
            = MapBinder.newMapBinder(binder(), String.class, IDictionaryProvider.class);
    parserDictionaryPlugins
            .addBinding(IntegerDictionaryProvider.ID)
            .to(IntegerDictionaryProvider.class);
    parserDictionaryPlugins
            .addBinding(DecimalDictionaryProvider.ID)
            .to(DecimalDictionaryProvider.class);
    parserDictionaryPlugins
            .addBinding(OrdinalNumbersDictionaryProvider.ID)
            .to(OrdinalNumbersDictionaryProvider.class);
    parserDictionaryPlugins
            .addBinding(PunctuationDictionaryProvider.ID)
            .to(PunctuationDictionaryProvider.class);
    parserDictionaryPlugins
            .addBinding(TimeExpressionDictionaryProvider.ID)
            .to(TimeExpressionDictionaryProvider.class);
    parserDictionaryPlugins
            .addBinding(EmailDictionaryProvider.ID)
            .to(EmailDictionaryProvider.class);
    parserDictionaryPlugins
            .addBinding(RegularDictionaryProvider.ID)
            .to(RegularDictionaryProvider.class);
}
 
Example #5
Source File: SemanticParserModule.java    From EDDI with Apache License 2.0 6 votes vote down vote up
private void initNormalizerPlugins() {
    MapBinder<String, INormalizerProvider> parserNormalizerPlugins
            = MapBinder.newMapBinder(binder(), String.class, INormalizerProvider.class);
    parserNormalizerPlugins
            .addBinding(PunctuationNormalizerProvider.ID)
            .to(PunctuationNormalizerProvider.class);
    parserNormalizerPlugins
            .addBinding(ConvertSpecialCharacterNormalizerProvider.ID)
            .to(ConvertSpecialCharacterNormalizerProvider.class);
    parserNormalizerPlugins
            .addBinding(ContractedWordNormalizerProvider.ID)
            .to(ContractedWordNormalizerProvider.class);
    parserNormalizerPlugins
            .addBinding(RemoveUndefinedCharacterNormalizerProvider.ID)
            .to(RemoveUndefinedCharacterNormalizerProvider.class);
}
 
Example #6
Source File: WsMasterModule.java    From che with Eclipse Public License 2.0 6 votes vote down vote up
private void configureJwtProxySecureProvisioner(String infrastructure) {
  install(new FactoryModuleBuilder().build(JwtProxyProvisionerFactory.class));
  if (KubernetesInfrastructure.NAME.equals(infrastructure)) {
    install(
        new FactoryModuleBuilder()
            .build(
                new TypeLiteral<JwtProxySecureServerExposerFactory<KubernetesEnvironment>>() {}));
    MapBinder.newMapBinder(
            binder(),
            new TypeLiteral<String>() {},
            new TypeLiteral<SecureServerExposerFactory<KubernetesEnvironment>>() {})
        .addBinding("jwtproxy")
        .to(new TypeLiteral<JwtProxySecureServerExposerFactory<KubernetesEnvironment>>() {});
  } else {
    install(
        new FactoryModuleBuilder()
            .build(
                new TypeLiteral<JwtProxySecureServerExposerFactory<OpenShiftEnvironment>>() {}));
    MapBinder.newMapBinder(
            binder(),
            new TypeLiteral<String>() {},
            new TypeLiteral<SecureServerExposerFactory<OpenShiftEnvironment>>() {})
        .addBinding("jwtproxy")
        .to(new TypeLiteral<JwtProxySecureServerExposerFactory<OpenShiftEnvironment>>() {});
  }
}
 
Example #7
Source File: BillingServerModule.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
@Override
protected void configure() {
   // No Session Listeners
   Multibinder<SessionListener> slBindings = Multibinder.newSetBinder(binder(), SessionListener.class);

   // Bind Http Handlers
   Multibinder<RequestHandler> rhBindings = Multibinder.newSetBinder(binder(), RequestHandler.class);
   rhBindings.addBinding().to(RootRedirect.class);
   rhBindings.addBinding().to(IndexPage.class);
   rhBindings.addBinding().to(CheckPage.class);
   rhBindings.addBinding().to(RecurlyCallbackHttpHandler.class);

   bind(RequestAuthorizer.class)
      .annotatedWith(Names.named("SessionAuthorizer"))
      .to(AlwaysAllow.class);

   MapBinder<String,WebhookHandler<? extends Object>> actionBinder = MapBinder.newMapBinder(binder(),new TypeLiteral<String>(){},new TypeLiteral<WebhookHandler<? extends Object>>(){});
   actionBinder.addBinding(RecurlyCallbackHttpHandler.TRANS_TYPE_CLOSED_INVOICE_NOTIFICATION).to(ClosedInvoiceWebhookHandler.class);

   // use the BaseHandler because it isn't abstract as the name implies, its just doesn't fully support websockets
   bind(ChannelInboundHandler.class).toProvider(BaseWebSocketServerHandlerProvider.class);

   // TODO bind this up into a WebSocket / NoWebSocket module...
   bind(RequestMatcher.class).annotatedWith(Names.named("WebSocketUpgradeMatcher")).to(NeverMatcher.class);
}
 
Example #8
Source File: BendConnectionPolicyTests.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
protected void bindAnchorageAdapters(final MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
	// transform policy
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(TransformPolicy.class);
	// relocate on drag
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(TranslateSelectedOnDragHandler.class);
	// bind dynamic anchor provider
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(TestAnchorProvider.class);
}
 
Example #9
Source File: SuroClientModule.java    From suro with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    MapBinder<String, ILoadBalancer> loadBalancers = MapBinder.newMapBinder(binder(), String.class, ILoadBalancer.class);
    loadBalancers.addBinding("eureka").to(EurekaLoadBalancer.class);
    loadBalancers.addBinding("static").to(StaticLoadBalancer.class);
    
    MapBinder<String, ISuroClient> clientImpls = MapBinder.newMapBinder(binder(), String.class, ISuroClient.class);
    clientImpls.addBinding("async").to(AsyncSuroClient.class).in(LazySingletonScope.get());
    clientImpls.addBinding("sync").to(SyncSuroClient.class).in(LazySingletonScope.get());
    
    bind(ISuroClient.class).toProvider(ConfigBasedSuroClientProvider.class);
    bind(ILoadBalancer.class).toProvider(ConfigBasedLoadBalancerProvider.class);
}
 
Example #10
Source File: ZestFxModule.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Adds (default) adapter map bindings for {@link EdgeLabelPart} and all
 * sub-classes. May be overwritten by sub-classes to change the default
 * bindings.
 *
 * @param adapterMapBinder
 *            The {@link MapBinder} to be used for the binding registration.
 *            In this case, will be obtained from
 *            {@link AdapterMaps#getAdapterMapBinder(Binder, Class)} using
 *            {@link EdgeLabelPart} as a key.
 *
 * @see AdapterMaps#getAdapterMapBinder(Binder, Class)
 */
protected void bindEdgeLabelPartAdapters(MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
	// selection link feedback provider
	adapterMapBinder
			.addBinding(
					AdapterKey.role(DefaultSelectionFeedbackPartFactory.SELECTION_LINK_FEEDBACK_GEOMETRY_PROVIDER))
			.to(ShapeBoundsProvider.class);

	// selection feedback provider
	adapterMapBinder
			.addBinding(AdapterKey.role(DefaultSelectionFeedbackPartFactory.SELECTION_FEEDBACK_GEOMETRY_PROVIDER))
			.to(ShapeBoundsProvider.class);

	// hover feedback provider
	adapterMapBinder.addBinding(AdapterKey.role(DefaultHoverFeedbackPartFactory.HOVER_FEEDBACK_GEOMETRY_PROVIDER))
			.to(ShapeBoundsProvider.class);

	// transform policy
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(TransformLabelPolicy.class);

	// hiding behavior
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(EdgeLabelHidingBehavior.class);

	// hover on-hover policy
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(HoverOnHoverHandler.class);

	// translate on drag
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(TranslateSelectedOnDragHandler.class);
}
 
Example #11
Source File: ZestFxModule.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void bindIViewerAdaptersForContentViewer(MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
	super.bindIViewerAdaptersForContentViewer(adapterMapBinder);
	bindNavigationModelAsContentViewerAdapter(adapterMapBinder);
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(HidingModel.class);
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(LabelOffsetSupport.class);
}
 
Example #12
Source File: MyriadTestModule.java    From incubator-myriad with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void configure() {

  ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
  try {
    cfg = mapper.readValue(Thread.currentThread().getContextClassLoader().getResource("myriad-config-test-default.yml"),
        MyriadConfiguration.class);
  } catch (IOException e1) {
    LOGGER.error("IOException", e1);
    return;
  }

  if (cfg == null) {
    return;
  }

  bind(MyriadConfiguration.class).toInstance(cfg);

  MapBinder<String, TaskFactory> mapBinder = MapBinder.newMapBinder(binder(), String.class, TaskFactory.class);
  mapBinder.addBinding(NodeManagerConfiguration.DEFAULT_NM_TASK_PREFIX).to(NMTaskFactory.class).in(Scopes.SINGLETON);
  Map<String, ServiceConfiguration> auxServicesConfigs = cfg.getServiceConfigurations();
  for (Map.Entry<String, ServiceConfiguration> entry : auxServicesConfigs.entrySet()) {
    String taskFactoryClass = entry.getValue().getTaskFactoryImplName().orNull();
    if (taskFactoryClass != null) {
      try {
        Class<? extends TaskFactory> implClass = (Class<? extends TaskFactory>) Class.forName(taskFactoryClass);
        mapBinder.addBinding(entry.getKey()).to(implClass).in(Scopes.SINGLETON);
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      }
    } else {
      mapBinder.addBinding(entry.getKey()).to(ServiceTaskFactory.class).in(Scopes.SINGLETON);
    }
  }
}
 
Example #13
Source File: AemComponentModule.java    From bobcat with Apache License 2.0 5 votes vote down vote up
private void bindCommonToolbarOptions() {
  MapBinder<String, ToolbarOption> toolbarOptions =
      MapBinder.newMapBinder(binder(), String.class, ToolbarOption.class);
  Arrays.stream(CommonToolbarOptions.values()).forEach(
      option -> toolbarOptions.addBinding(option.getTitle())
          .toInstance(new CommonToolbarOption(option.getTitle())));
}
 
Example #14
Source File: DiagnosticModule.java    From seed with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    MapBinder<String, DiagnosticInfoCollector> diagnosticInfoCollectorMapBinder = MapBinder.newMapBinder(binder(),
            String.class, DiagnosticInfoCollector.class);
    for (Map.Entry<String, Class<? extends DiagnosticInfoCollector>> diagnosticInfoCollectorEntry :
            diagnosticInfoCollectorClasses.entrySet()) {
        diagnosticInfoCollectorMapBinder.addBinding(diagnosticInfoCollectorEntry.getKey()).to(
                diagnosticInfoCollectorEntry.getValue());
    }
    bind(DiagnosticManager.class).toInstance(diagnosticManager);
}
 
Example #15
Source File: AemLoginModule.java    From bobcat with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
  LOG.debug("Configuring Bobcat module: {}", getClass().getSimpleName());

  bind(AemAuthCookieFactory.class).to(AemAuthCookieFactoryImpl.class);

  MapBinder<String, Action> siteAdminActions =
      MapBinder.newMapBinder(binder(), String.class, Action.class);
  siteAdminActions.addBinding(AemActions.LOG_IN).to(LogIn.class);
  siteAdminActions.addBinding(AemActions.LOG_OUT).to(LogOut.class);
}
 
Example #16
Source File: AemSitesAdminModule.java    From bobcat with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
  LOG.debug("Configuring Bobcat module: {}", getClass().getSimpleName());

  bind(SiteToolbar.class).to(SiteToolbarImpl.class);
  bind(TemplateList.class).to(TemplateListImpl.class);
  bind(CreatePageWizard.class).to(CreatePageWizardImpl.class);
  bind(CreatePageProperties.class).to(CreatePagePropertiesImpl.class);

  MapBinder<String, ActionWithData> siteAdminActions =
      MapBinder.newMapBinder(binder(), String.class, ActionWithData.class);
  siteAdminActions.addBinding(AemActions.CREATE_PAGE_VIA_SITEADMIN).to(CreatePageAction.class);
}
 
Example #17
Source File: AemComponentModule.java    From bobcat with Apache License 2.0 5 votes vote down vote up
private void bindCommonToolbarOptions() {
  MapBinder<String, ToolbarOption> toolbarOptions =
      MapBinder.newMapBinder(binder(), String.class, ToolbarOption.class);
  Arrays.stream(CommonToolbarOptions.values()).forEach(
      option -> toolbarOptions.addBinding(option.getTitle())
          .toInstance(new CommonToolbarOption(option.getTitle())));
}
 
Example #18
Source File: SlingPageActionsModule.java    From bobcat with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
  MapBinder<String, ActionWithData> slingPageActions =
      MapBinder.newMapBinder(binder(), String.class, ActionWithData.class);
  slingPageActions.addBinding(AemActions.CREATE_PAGE_VIA_SLING).to(CreatePage.class);
  slingPageActions.addBinding(AemActions.DELETE_PAGE_VIA_SLING).to(DeletePage.class);
}
 
Example #19
Source File: XadesProfileCore.java    From xades4j with GNU Lesser General Public License v3.0 5 votes vote down vote up
public <T> void addMapBinding(final Class<T> valueClass, final Object key, final Class<? extends T> to)
{
    if (null == key || null == to)
        throw new NullPointerException();

    this.bindings.add(new BindingAction()
    {
        @Override
        public void bind(Binder b)
        {
            MapBinder mapBinder = MapBinder.newMapBinder(b, key.getClass(), valueClass);
            mapBinder.addBinding(key).to(to);
        }
    });
}
 
Example #20
Source File: PhysicalOperatorBuiltinsModule.java    From yql-plus with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    MapBinder<String, ModuleType> prefixModuleBindings = MapBinder.newMapBinder(binder(), String.class, ModuleType.class);
    prefixModuleBindings.addBinding("yql.sequences").to(SequenceBuiltinsModule.class);
    prefixModuleBindings.addBinding("yql.conditionals").to(ConditionalsBuiltinsModule.class);
    prefixModuleBindings.addBinding("yql.records").to(RecordsBuiltinsModule.class);
}
 
Example #21
Source File: SourceApiModule.java    From yql-plus with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    MapBinder<String, Source> sourceBindings = MapBinder.newMapBinder(binder(), String.class, Source.class);
    MapBinder<String, Exports> exportsBindings = MapBinder.newMapBinder(binder(), String.class, Exports.class);
    Multibinder<SourceNamespace> sourceNamespaceMultibinder = Multibinder.newSetBinder(binder(), SourceNamespace.class);
    Multibinder<ModuleNamespace> moduleNamespaceMultibinder = Multibinder.newSetBinder(binder(), ModuleNamespace.class);
    sourceNamespaceMultibinder.addBinding().to(MultibinderPlannerNamespace.class);
    moduleNamespaceMultibinder.addBinding().to(MultibinderPlannerNamespace.class);
}
 
Example #22
Source File: JavaTestModule.java    From yql-plus with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    install(new JavaEngineModule());
    install(metricModule);
    MapBinder<String, Source> sourceBindings = MapBinder.newMapBinder(binder(), String.class, Source.class);
    sourceBindings.addBinding("minions").toInstance(new MinionSource(ImmutableList.of(new Minion("1", "2"), new Minion("1", "3"))));
    sourceBindings.addBinding("people").toInstance(new PersonSource(ImmutableList.of(new Person("1", "bob", 0), new Person("2", "joe", 1), new Person("3", "smith", 2))));
    sourceBindings.addBinding("citizen").toInstance(new CitizenSource(ImmutableList.of(new Citizen("1", "German"), new Citizen("2", "Italian"), new Citizen("3", "U.S. American"))));
    sourceBindings.addBinding("peopleWithNullId").toInstance(new PersonSource(ImmutableList.of(new Person(null, "bob", 0), new Person("2", "joe", 1), new Person("3", "smith", 2))));
    sourceBindings.addBinding("peopleWithEmptyId").toInstance(new PersonSource(ImmutableList.of(new Person("", "bob", 0), new Person("2", "joe", 1), new Person("3", "smith", 2))));
    sourceBindings.addBinding("moreMinions").toInstance(new MinionSource(ImmutableList.of(new Minion("1", "2"), new Minion("1", "3"), new Minion("2", "1"))));
    sourceBindings.addBinding("minionsWithSkipNullSetToFalse").toInstance(new MinionSourceWithSkipNullSetToFalse(ImmutableList.of(new Minion(null, "2"), new Minion("1", "3"), new Minion("2", "1"))));
    sourceBindings.addBinding("noMatchMinions").toInstance(new MinionSource(ImmutableList.of(new Minion("4", "2"), new Minion("4", "3"), new Minion("5", "1"))));
    sourceBindings.addBinding("images").toInstance(new ImageSource(ImmutableList.of(new Image("1", "1.jpg"), new Image("3", "3.jpg"))));
    sourceBindings.addBinding("innersource").to(InnerSource.class);
    sourceBindings.addBinding("asyncsource").to(AsyncSource.class);
    sourceBindings.addBinding("trace").to(TracingSource.class);
    sourceBindings.addBinding("mapsource").to(MapSource.class);
    sourceBindings.addBinding("mapArgumentSource").to(MapArgumentSource.class);
    sourceBindings.addBinding("personList").toInstance(new PersonListMakeSource());
    bind(ViewRegistry.class).toInstance(new ViewRegistry() {
        @Override
        public OperatorNode<SequenceOperator> getView(List<String> name) {
            return null;
        }
    });
}
 
Example #23
Source File: BehaviorModule.java    From EDDI with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    bind(IBehaviorDeserialization.class).to(BehaviorDeserialization.class).in(Scopes.SINGLETON);
    MapBinder<String, ILifecycleTask> lifecycleTaskPlugins
            = MapBinder.newMapBinder(binder(), String.class, ILifecycleTask.class);
    lifecycleTaskPlugins.addBinding("ai.labs.behavior").to(BehaviorRulesEvaluationTask.class);

    MapBinder<String, IBehaviorCondition> behaviorConditionPlugins
            = MapBinder.newMapBinder(binder(), String.class, IBehaviorCondition.class);
    behaviorConditionPlugins.addBinding("ai.labs.behavior.conditions.inputmatcher").
            to(InputMatcher.class);
    behaviorConditionPlugins.addBinding("ai.labs.behavior.conditions.actionmatcher").
            to(ActionMatcher.class);
    behaviorConditionPlugins.addBinding("ai.labs.behavior.conditions.contextmatcher").
            to(ContextMatcher.class);
    behaviorConditionPlugins.addBinding("ai.labs.behavior.conditions.dynamicvaluematcher").
            to(DynamicValueMatcher.class);
    behaviorConditionPlugins.addBinding("ai.labs.behavior.conditions.connector").
            to(Connector.class);
    behaviorConditionPlugins.addBinding("ai.labs.behavior.conditions.dependency").
            to(Dependency.class);
    behaviorConditionPlugins.addBinding("ai.labs.behavior.conditions.negation").
            to(Negation.class);
    behaviorConditionPlugins.addBinding("ai.labs.behavior.conditions.occurrence").
            to(Occurrence.class);
    behaviorConditionPlugins.addBinding("ai.labs.behavior.conditions.sizematcher").
            to(SizeMatcher.class);
}
 
Example #24
Source File: ConversationCallbackModule.java    From EDDI with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    registerConfigFiles(configFiles);

    bind(IConversationCallback.class).to(ConversationCallback.class).in(Scopes.SINGLETON);

    MapBinder<String, ILifecycleTask> lifecycleTaskPlugins
            = MapBinder.newMapBinder(binder(), String.class, ILifecycleTask.class);
    lifecycleTaskPlugins.addBinding("ai.labs.callback").to(ConversationCallbackTask.class);

}
 
Example #25
Source File: MvcLogoExampleModule.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void bindAbstractContentPartAdapters(MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
	super.bindAbstractContentPartAdapters(adapterMapBinder);
	// select on click
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(FocusAndSelectOnClickHandler.class);
	// select on type
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(SelectFocusedOnTypeHandler.class);
}
 
Example #26
Source File: MvcFxModule.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Binds the {@link IHandlePartFactory} that is used to generate selection
 * handles.
 *
 * @param adapterMapBinder
 *            The {@link MapBinder} for content viewer adapters.
 */
protected void bindSelectionHandlePartFactoryAsContentViewerAdapter(
		MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
	adapterMapBinder
			.addBinding(AdapterKey
					.role(SelectionBehavior.SELECTION_HANDLE_PART_FACTORY))
			.to(DefaultSelectionHandlePartFactory.class);
}
 
Example #27
Source File: MvcFxModule.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Binds the {@link IFeedbackPartFactory} that is used to generate snapping
 * feedback.
 *
 * @param adapterMapBinder
 *            The {@link MapBinder} for content viewer adapters.
 */
protected void bindSnappingFeedbackPartFactoryAsContentViewerAdapter(
		MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
	adapterMapBinder
			.addBinding(AdapterKey
					.role(SnappingBehavior.SNAPPING_FEEDBACK_PART_FACTORY))
			.to(DefaultSnappingFeedbackPartFactory.class);
}
 
Example #28
Source File: MvcFxModule.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Binds the {@link IFeedbackPartFactory} that is used to generate hover
 * feedback.
 *
 * @param adapterMapBinder
 *            The {@link MapBinder} for content viewer adapters.
 */
protected void bindHoverFeedbackPartFactoryAsContentViewerAdapter(
		MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
	adapterMapBinder
			.addBinding(AdapterKey
					.role(HoverBehavior.HOVER_FEEDBACK_PART_FACTORY))
			.to(DefaultHoverFeedbackPartFactory.class);
}
 
Example #29
Source File: ZestFxModule.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void bindAbstractContentPartAdapters(MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
	super.bindAbstractContentPartAdapters(adapterMapBinder);
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(FocusAndSelectOnClickHandler.class);
	adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(SelectFocusedOnTypeHandler.class);
	adapterMapBinder
			.addBinding(AdapterKey.role(DefaultHoverIntentHandlePartFactory.HOVER_INTENT_HANDLES_GEOMETRY_PROVIDER))
			.to(ShapeBoundsProvider.class);
}
 
Example #30
Source File: MvcFxModule.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Binds the {@link IFeedbackPartFactory} that is used to generate focus
 * feedback.
 *
 * @param adapterMapBinder
 *            The {@link MapBinder} for content viewer adapters.
 */
protected void bindFocusFeedbackPartFactoryAsContentViewerAdapter(
		MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
	adapterMapBinder
			.addBinding(AdapterKey
					.role(FocusBehavior.FOCUS_FEEDBACK_PART_FACTORY))
			.to(DefaultFocusFeedbackPartFactory.class);
}