Java Code Examples for com.google.inject.name.Names
The following examples show how to use
com.google.inject.name.Names.
These examples are extracted from open source projects.
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 Project: spoofax Author: metaborg File: SpoofaxExtensionModule.java License: Apache License 2.0 | 6 votes |
@Override protected void configure() { autoClosableBinder = Multibinder.newSetBinder(binder(), AutoCloseable.class); spoofaxPrimitiveLibrary = Multibinder.newSetBinder(binder(), AbstractPrimitive.class, Names.named(SpoofaxPrimitiveLibrary.name)); legacySpoofaxPrimitiveLibrary = Multibinder.newSetBinder(binder(), AbstractPrimitive.class, Names.named(LegacySpoofaxPrimitiveLibrary.name)); bindAutoClosableSpoofaxPrimitive(LanguageSpecificationPrimitive.class); bindAutoClosableSpoofaxPrimitive(LanguageSpecSrcGenDirectory.class); bindAutoClosableSpoofaxPrimitive(LanguageSpecPpNamePrimitive.class); bindAutoClosableSpoofaxPrimitive(CheckSdf2TablePrimitive.class); bindAutoClosableSpoofaxPrimitive(PlaceholderCharsPrimitive.class); bindAutoClosableSpoofaxPrimitive(StrategoPieAnalyzePrimitive.class); bindSpoofaxPrimitive(LayoutSensitivePrettyPrinterPrimitive.class); bindSpoofaxPrimitive(GetContextualGrammarPrimitive.class); bindAutoClosableLegacySpoofaxPrimitive(LegacyLanguageSpecNamePrimitive.class); install(new StrIncrModule()); install(new GuiceTaskDefsModule()); }
Example #2
Source Project: examples-javafx-repos1 Author: bekwam File: OldScoresModule.java License: Apache License 2.0 | 6 votes |
@Override protected void configure() { String mathRecenteredJSONFile = MATH_RECENTERED_JSON_FILE; String verbalRecenteredJSONFile = VERBAL_RECENTERED_JSON_FILE; String settingsFileName = SETTINGS_FILE_NAME; bind(BuilderFactory.class).to(JavaFXBuilderFactory.class); bind(String.class).annotatedWith(Names.named("mathRecenteredJSONFile")).toInstance(mathRecenteredJSONFile); bind(String.class).annotatedWith(Names.named("verbalRecenteredJSONFile")).toInstance(verbalRecenteredJSONFile); bind(String.class).annotatedWith(Names.named("settingsFileName")).toInstance(settingsFileName); bind(SettingsDAO.class).to(SettingsDAOImpl.class).asEagerSingleton(); bind(RecenteredDAO.class).to(RecenteredDAOImpl.class).asEagerSingleton(); bindInterceptor(Matchers.subclassesOf(ManagedDataSource.class), Matchers.any(), new ManagedDataSourceInterceptor()); }
Example #3
Source Project: james-project Author: apache File: ReIndexingModule.java License: Apache License 2.0 | 6 votes |
@Override protected void configure() { Multibinder.newSetBinder(binder(), TaskRegistration.class, Names.named(USER_MAILBOXES_OPERATIONS_INJECTION_KEY)) .addBinding() .to(UserReIndexingTaskRegistration.class); Multibinder.newSetBinder(binder(), TaskRegistration.class, Names.named(ALL_MAILBOXES_TASKS)) .addBinding() .to(MailboxesRoutes.ReIndexAllMailboxesTaskRegistration.class); Multibinder.newSetBinder(binder(), TaskRegistration.class, Names.named(ONE_MAILBOX_TASKS)) .addBinding() .to(MailboxesRoutes.ReIndexOneMailboxTaskRegistration.class); Multibinder.newSetBinder(binder(), TaskRegistration.class, Names.named(ONE_MAIL_TASKS)) .addBinding() .to(MailboxesRoutes.ReIndexOneMailTaskRegistration.class); }
Example #4
Source Project: incubator-gobblin Author: apache File: FlowStatusTest.java License: Apache License 2.0 | 6 votes |
@BeforeClass public void setUp() throws Exception { JobStatusRetriever jobStatusRetriever = new TestJobStatusRetriever(); final FlowStatusGenerator flowStatusGenerator = FlowStatusGenerator.builder().jobStatusRetriever(jobStatusRetriever).build(); Injector injector = Guice.createInjector(new Module() { @Override public void configure(Binder binder) { binder.bind(FlowStatusGenerator.class).annotatedWith(Names.named(FlowStatusResource.FLOW_STATUS_GENERATOR_INJECT_NAME)) .toInstance(flowStatusGenerator); } }); _server = EmbeddedRestliServer.builder().resources( Lists.<Class<? extends BaseResource>>newArrayList(FlowStatusResource.class)).injector(injector).build(); _server.startAsync(); _server.awaitRunning(); _client = new FlowStatusClient(String.format("http://localhost:%s/", _server.getPort())); }
Example #5
Source Project: n4js Author: eclipse File: N4JSClusteringBuilderConfiguration.java License: Eclipse Public License 1.0 | 6 votes |
@Override protected void configure() { bind(IResourceClusteringPolicy.class).to(VerboseClusteringPolicy.class); bind(XtextBuilder.class).to(N4JSBuildTypeTrackingBuilder.class); bind(IBuilderState.class).to(N4JSGenerateImmediatelyBuilderState.class).in(Scopes.SINGLETON); bind(IMarkerUpdater.class).to(N4JSMarkerUpdater.class); bind(IStorage2UriMapper.class).to(N4JSStorage2UriMapper.class); bind(PersistedStateProvider.class).to(ContributingResourceDescriptionPersister.class); bind(IBuildLogger.class).annotatedWith(BuilderState.class).to(BuilderStateLogger.class); bind(DirtyStateManager.class).to(PrevStateAwareDirtyStateManager.class); bind(IResourceLoader.class).annotatedWith( Names.named(ClusteringBuilderState.RESOURCELOADER_GLOBAL_INDEX)).toProvider( new BuildScopeAwareParallelLoaderProvider()); bind(BuilderStateDiscarder.class); bind(SharedStateContributionRegistryImpl.class).to(DefaultSharedContributionOverridingRegistry.class); binder().install(new MyReferenceSearchResultContentProviderCustomModule()); }
Example #6
Source Project: attic-rave Author: apache File: OAuthGuiceModule.java License: Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected void configure() { bind(BlobCrypter.class).annotatedWith(Names.named(OAuthFetcherConfig.OAUTH_STATE_CRYPTER)) .toProvider(OAuthModule.OAuthCrypterProvider.class); bind(OAuthRequest.class).toProvider(OAuthModule.OAuthRequestProvider.class); //Required for SampleOAuthDataStore bind(String.class).annotatedWith(Names.named("shindig.canonical.json.db")) .toInstance("sampledata/canonicaldb.json"); bind(OAuthDataStore.class).to(SampleOAuthDataStore.class); }
Example #7
Source Project: seed Author: seedstack File: EncryptionServiceBindingFactoryTest.java License: Mozilla Public License 2.0 | 5 votes |
@Test public void test_encryption_service_collect_with_qualifier() { prepareMock(); EncryptionServiceBindingFactory collector = new EncryptionServiceBindingFactory(); Map<Key<EncryptionService>, EncryptionService> encryptionServiceMap = collector.createBindings( prepareKeyPairWithQualifier("foo"), keyStores); Assertions.assertThat(encryptionServiceMap).hasSize(1); Assertions.assertThat(encryptionServiceMap).containsKey(Key.get(EncryptionService.class, Names.named("foo"))); Assertions.assertThat(encryptionServiceMap).containsValue(encryptionService); }
Example #8
Source Project: act-platform Author: mnemonic-no File: AbstractEndpointTest.java License: ISC License | 5 votes |
@Override protected void configure() { install(new TiRestModule()); bind(ThreatIntelligenceService.class).toInstance(tiService); bind(String.class).annotatedWith(Names.named("act.api.server.port")).toInstance(String.valueOf(port)); bind(String.class).annotatedWith(Names.named("act.api.cors.allowed.origins")).toInstance("http://www.example.org"); }
Example #9
Source Project: Orienteer Author: OrienteerBAP File: OUsersCommonUtils.java License: Apache License 2.0 | 5 votes |
public static List<IOAuth2Provider> getOAuth2Providers() { OrienteerWebApplication app = OrienteerWebApplication.lookupApplication(); if (app == null) { return Collections.emptyList(); } Named named = Names.named("orienteer.oauth2.providers"); Key<List<IOAuth2Provider>> key = Key.get(new TypeLiteral<List<IOAuth2Provider>>() {}, named); return app.getInjector().getInstance(key); }
Example #10
Source Project: attic-stratos Author: apache File: GCEIaas.java License: Apache License 2.0 | 5 votes |
private Operation waitGCEOperationDone(Operation operation) { IaasProvider iaasInfo = getIaasProvider(); Injector injector = ContextBuilder.newBuilder(iaasInfo.getProvider()) .credentials(iaasInfo.getIdentity(), iaasInfo.getCredential()) .buildInjector(); Predicate<AtomicReference<Operation>> zoneOperationDonePredicate = injector.getInstance(Key.get(new TypeLiteral<Predicate<AtomicReference<Operation>>>() { }, Names.named("zone"))); AtomicReference<Operation> operationReference = Atomics.newReference(operation); retry(zoneOperationDonePredicate, MAX_WAIT_TIME, 1, SECONDS).apply(operationReference); return operationReference.get(); }
Example #11
Source Project: arcusplatform Author: arcus-smart-home File: AbstractIpcdServerModule.java License: Apache License 2.0 | 5 votes |
@Override protected final void configure() { bind(BridgeServerConfig.class); bind(TrustConfig.class); bind(BridgeServerTlsContext.class).to(BridgeServerTlsContextImpl.class); bind(BridgeServerTrustManagerFactory.class).to(SimpleTrustManagerFactoryImpl.class); bind(ProtocolBusService.class).to(ProtocolBusServiceImpl.class).asEagerSingleton(); bindSetOf(ProtocolBusListener.class).addBinding().to(IpcdProtocolBusListener.class); bind(PlatformBusService.class).to(IpcdPlatformBusServiceImpl.class).asEagerSingleton(); Multibinder<PlatformBusListener> platformListenerBinder = bindSetOf(PlatformBusListener.class); platformListenerBinder.addBinding().to(IpcdServiceEventListener.class); bindMessageHandler(); bind(Authenticator.class).to(NoopAuthenticator.class); bind(ClientFactory.class).to(IpcdClientFactory.class); bind(new TypeLiteral<ChannelInitializer<SocketChannel>>(){}).to(Bridge10ChannelInitializer.class); bind(ChannelInboundHandler.class).toProvider(Text10WebSocketServerHandlerProvider.class); bindSessionFactory(); bind(SessionRegistry.class).to(DefaultSessionRegistryImpl.class); bindSessionSupplier(); bind(SessionHeartBeater.class); bind(DefaultIpcdDeliveryStrategy.class); bindDeliveryStrategies(); bind(RequestMatcher.class).annotatedWith(Names.named("WebSocketUpgradeMatcher")).to(WebSocketUpgradeMatcher.class); bind(RequestAuthorizer.class).annotatedWith(Names.named("SessionAuthorizer")).to(AlwaysAllow.class); Multibinder<SessionListener> slBindings = Multibinder.newSetBinder(binder(), SessionListener.class); bindSessionListener(slBindings); Multibinder<RequestHandler> rhBindings = Multibinder.newSetBinder(binder(), RequestHandler.class); rhBindings.addBinding().to(RootRedirect.class); bindHttpHandlers(rhBindings); }
Example #12
Source Project: flux Author: flipkart-incubator File: TestModule.java License: Apache License 2.0 | 5 votes |
@Override protected void configure() { bind(SessionFactoryContext.class).toInstance(context); bind(Session.class).annotatedWith(Names.named("shardedReadWriteSession")). toInstance(shardedReadWriteSession); bind(Session.class).annotatedWith(Names.named("shardedReadOnlySession")). toInstance(shardedReadOnlySession); bind(Session.class).annotatedWith(Names.named("schedulerSession")). toInstance(schedulerSession); bind(InterceptedClass.class); bindInterceptor(Matchers.subclassesOf(InterceptedClass.class), Matchers.annotatedWith(Transactional.class), new TransactionInterceptor(() -> context)); }
Example #13
Source Project: che Author: eclipse File: KubernetesDevfileBindings.java License: Eclipse Public License 2.0 | 5 votes |
/** * Any workspace environments based on Kubernetes recipes need to register the binding using this * method so that the {@link KubernetesComponentProvisioner} and {@link * KubernetesEnvironmentProvisioner} can work properly with these environments. * * @param baseBinder the binder available in the Guice module calling this method. * @param environmentTypes the environment types to be registered as handled by Kubernetes recipes */ public static void addKubernetesBasedEnvironmentTypeBindings( Binder baseBinder, String... environmentTypes) { Multibinder<String> binder = Multibinder.newSetBinder( baseBinder, String.class, Names.named(KUBERNETES_BASED_ENVIRONMENTS_KEY_NAME)); for (String envType : environmentTypes) { binder.addBinding().toInstance(envType); } }
Example #14
Source Project: vespa Author: vespa-engine File: ServerRepositoryIntegrationTest.java License: Apache License 2.0 | 5 votes |
@Override protected void configure() { bind(CountDownLatch.class).annotatedWith(Names.named("Init")).toInstance(init); bind(CountDownLatch.class).annotatedWith(Names.named("Start")).toInstance(start); bind(CountDownLatch.class).annotatedWith(Names.named("Close")).toInstance(close); bind(CountDownLatch.class).annotatedWith(Names.named("Destroy")).toInstance(destroy); }
Example #15
Source Project: xtext-core Author: eclipse File: AbstractSerializationBug269362TestLanguageRuntimeModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureFileExtensions(Binder binder) { if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null) binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("serializationbug269362testlanguage"); }
Example #16
Source Project: xtext-core Author: eclipse File: ValidatorTester.java License: Eclipse Public License 2.0 | 4 votes |
public ValidatorTester(T validator, Injector injector) { this(validator, injector.getInstance(EValidatorRegistrar.class), injector.getInstance(Key.get(String.class, Names.named(Constants.LANGUAGE_NAME)))); }
Example #17
Source Project: xtext-core Author: eclipse File: AbstractLiveContainerTestLanguageRuntimeModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureLanguageName(Binder binder) { binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.resource.LiveContainerTestLanguage"); }
Example #18
Source Project: sarl Author: sarl File: AbstractSARLUiModule.java License: Apache License 2.0 | 4 votes |
public void configureContentAssistLexer(Binder binder) { binder.bind(Lexer.class) .annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST)) .to(InternalSARLLexer.class); }
Example #19
Source Project: xtext-eclipse Author: eclipse File: AbstractBmTestLanguageRuntimeModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureRuntimeLexer(Binder binder) { binder.bind(Lexer.class) .annotatedWith(Names.named(LexerBindings.RUNTIME)) .to(InternalBmTestLanguageLexer.class); }
Example #20
Source Project: xtext-core Author: eclipse File: AbstractLocationProviderTestLanguageRuntimeModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureFileExtensions(Binder binder) { if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null) binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("locationprovidertestlanguage"); }
Example #21
Source Project: xtext-core Author: eclipse File: AbstractFowlerDslTestLanguageRuntimeModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureLanguageName(Binder binder) { binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.testlanguages.FowlerDslTestLanguage"); }
Example #22
Source Project: xtext-core Author: eclipse File: AbstractBeeLangTestLanguageRuntimeModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureIScopeProviderDelegate(Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class); }
Example #23
Source Project: xtext-core Author: eclipse File: AbstractSimpleBeeLangTestLanguageRuntimeModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureFileExtensions(Binder binder) { if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null) binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("simplebeelangtestlanguage"); }
Example #24
Source Project: xtext-eclipse Author: eclipse File: AbstractRefactoringTestLanguageRuntimeModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureRuntimeLexer(Binder binder) { binder.bind(Lexer.class) .annotatedWith(Names.named(LexerBindings.RUNTIME)) .to(InternalRefactoringTestLanguageLexer.class); }
Example #25
Source Project: phoenix-omid Author: apache File: VoidLeaseManagementModule.java License: Apache License 2.0 | 4 votes |
@Override protected void configure() { LOG.info(this.toString()); bindConstant().annotatedWith(Names.named(HBaseTimestampStorageConfig.TIMESTAMP_STORAGE_TABLE_NAME_KEY)).to(tableName); install(new HBaseConfigModule(principal, keytab)); }
Example #26
Source Project: xtext-core Author: eclipse File: AbstractIgnoreCaseImportsTestLanguageRuntimeModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureRuntimeLexer(Binder binder) { binder.bind(Lexer.class) .annotatedWith(Names.named(LexerBindings.RUNTIME)) .to(InternalIgnoreCaseImportsTestLanguageLexer.class); }
Example #27
Source Project: xtext-web Author: eclipse File: AbstractStatemachineRuntimeModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureIScopeProviderDelegate(Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class); }
Example #28
Source Project: xtext-core Author: eclipse File: AbstractLiveContainerTestLanguageRuntimeModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureRuntimeLexer(Binder binder) { binder.bind(Lexer.class) .annotatedWith(Names.named(LexerBindings.RUNTIME)) .to(InternalLiveContainerTestLanguageLexer.class); }
Example #29
Source Project: xtext-eclipse Author: eclipse File: AbstractCodetemplatesRuntimeModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureIScopeProviderDelegate(Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class); }
Example #30
Source Project: xtext-eclipse Author: eclipse File: AbstractBug348199TestLanguageUiModule.java License: Eclipse Public License 2.0 | 4 votes |
public void configureHighlightingTokenDefProvider(Binder binder) { binder.bind(ITokenDefProvider.class) .annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING)) .to(AntlrTokenDefProvider.class); }