Java Code Examples for javax.inject.Named

The following are top voted examples for showing how to use javax.inject.Named. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: CleanArchitechture   File: BaseFragmentModule.java   View source code 6 votes vote down vote up
@Provides
@Named(CHILD_FRAGMENT_MANAGER)
@PerFragment
static FragmentManager childFragmentManager(@Named(FRAGMENT) Fragment fragment) {
    return fragment.getChildFragmentManager();
}
 
Example 2
Project: verify-hub   File: SamlEngineModule.java   View source code 6 votes vote down vote up
@Provides
@SuppressWarnings("unused")
private Function<HubAttributeQueryRequest, Element> getMatchingServiceRequestElementTransformer(
        IdaKeyStore keyStore,
        EncryptionKeyStore encryptionKeyStore,
        EntityToEncryptForLocator entityToEncryptForLocator,
        SignatureAlgorithm signatureAlgorithm,
        DigestAlgorithm digestAlgorithm,
        @Named("HubEntityId") String hubEntityId
) {
    return hubTransformersFactory.getMatchingServiceRequestToElementTransformer(
            keyStore,
            encryptionKeyStore,
            entityToEncryptForLocator,
            signatureAlgorithm,
            digestAlgorithm,
            hubEntityId
    );
}
 
Example 3
Project: ProjectAres   File: InjectableMethodTest.java   View source code 6 votes vote down vote up
@Test
public void qualifiedDependency() throws Exception {
    class Woot {
        String foo(@Named("q") int i) {
            return String.valueOf(i);
        }
    }

    InjectableMethod<?> method = InjectableMethod.forDeclaredMethod(new Woot(), "foo", int.class);
    String hi = Guice.createInjector(
        method.bindingModule(),
        binder -> binder.bind(int.class)
                        .annotatedWith(Names.named("q"))
                        .toInstance(123)
    ).getInstance(String.class);


    assertEquals("123", hi);
}
 
Example 4
Project: verify-hub   File: SamlEngineModule.java   View source code 5 votes vote down vote up
@Provides
@Named("IdpSamlResponseTransformer")
private DecoratedSamlResponseToIdaResponseIssuedByIdpTransformer getResponseToInboundResponseFromIdpTransformer(
        ConcurrentMap<String, DateTime> assertionIdCache,
        SamlConfiguration samlConfiguration,
        @Named("authnResponseKeyStore") SigningKeyStore authnResponseKeyStore,
        IdaKeyStore keyStore,
        @Named("HubEntityId") String hubEntityId) {

    return hubTransformersFactory.getDecoratedSamlResponseToIdaResponseIssuedByIdpTransformer(
            authnResponseKeyStore, keyStore, samlConfiguration.getExpectedDestinationHost(),
            Urls.FrontendUrls.SAML2_SSO_RESPONSE_ENDPOINT, assertionIdCache,
            hubEntityId);
}
 
Example 5
Project: OperatieBRP   File: BevragingVerzoekVerwerkerProvider.java   View source code 5 votes vote down vote up
/**
 * {@link BevragingVerzoekVerwerker} specifiek voor Zoek Persoon Op Adres.
 * @return de zoek persoon op adres verzoek verwerker
 */
@Bean
@Named("zoekPersoonOpAdres")
public BevragingVerzoekVerwerker<ZoekPersoonOpAdresVerzoek> zoekPersoonOpAdresVerzoekVerwerker() {
    return new GeneriekeBevragingVerzoekVerwerker<ZoekPersoonOpAdresVerzoek, BevragingResultaat>() {
    };
}
 
Example 6
Project: OperatieBRP   File: BevragingVerzoekVerwerkerProvider.java   View source code 5 votes vote down vote up
/**
 * {@link BevragingVerzoekVerwerker} specifiek voor Geef Details Persoon.
 * @return de geef details persoon verzoek verwerker
 */
@Bean
@Named("geefDetailsPersoonVerwerker")
public BevragingVerzoekVerwerker<GeefDetailsPersoonVerzoek> geefDetailsPersoonVerzoekVerwerker() {
    return new GeneriekeBevragingVerzoekVerwerker<GeefDetailsPersoonVerzoek, BevragingResultaat>() {
    };
}
 
Example 7
Project: mapr-music   File: RateService.java   View source code 5 votes vote down vote up
@Inject
public RateService(AlbumRateDao albumRateDao,
                   ArtistRateDao artistRateDao,
                   @Named("albumDao") AlbumDao albumDao,
                   @Named("artistDao") ArtistDao artistDao,
                   @Named("userDao") MaprDbDao<User> userDao) {

    this.albumRateDao = albumRateDao;
    this.artistRateDao = artistRateDao;
    this.albumDao = albumDao;
    this.artistDao = artistDao;
    this.userDao = userDao;
}
 
Example 8
Project: OperatieBRP   File: ConversieAangifteAdreshoudingController.java   View source code 5 votes vote down vote up
/**
 * Constructor.
 * @param repository repository
 */
@Inject
protected ConversieAangifteAdreshoudingController(
    @Named("conversieAangifteAdreshoudingRepository") final ReadWriteRepository<AangifteAdreshouding, Integer> repository) {
    super(repository,
            Arrays.asList(
                    new Filter<>(LO3_OMSCHRIJVING, new StringValueAdapter(), new LikePredicateBuilderFactory(LO3_OMSCHRIJVING)),
                    new Filter<>(AANGEVER_ID, new ShortValueAdapter(), new EqualPredicateBuilderFactory(AANGEVER_ID)),
                    new Filter<>(REDENWIJZIGINGVERBLIJF_ID, new ShortValueAdapter(), new EqualPredicateBuilderFactory(REDENWIJZIGINGVERBLIJF_ID))),
            null,
            Arrays.asList(LO3_OMSCHRIJVING, AANGEVER, REDENWIJZIGINGVERBLIJF));
}
 
Example 9
Project: github-users   File: DrawerPresenter.java   View source code 5 votes vote down vote up
@Inject
public DrawerPresenter(
    @Named("projectGitHubUrl") String projectUrl,
    Sink<SnackbarMessageEvent> snackbarMessageSink,
    UrlOpener urlOpener) {

  this.projectUrl = projectUrl;
  this.snackbarMessageSink = snackbarMessageSink;
  this.urlOpener = urlOpener;
}
 
Example 10
Project: bcg   File: ClientModule.java   View source code 5 votes vote down vote up
@Provides
@Singleton
public Cache provideCache(@Named("cacheDir") File cacheDir, @Named("cacheSize") long cacheSize) {
    Cache cache = null;

    try {
        cache = new Cache(new File(cacheDir.getPath(), HTTP_CACHE_PATH), cacheSize);
    } catch (Exception e) {
        e.printStackTrace();
    }

    return cache;
}
 
Example 11
Project: Dagger2-Retrofit-MVP-OKHttp3-ButterKnife-Glide-Example   File: ApplicationModule.java   View source code 5 votes vote down vote up
@Singleton
@Provides
Retrofit provideRetrofit(@Named("ok-1") OkHttpClient client, GsonConverterFactory converterFactory
        , RxJavaCallAdapterFactory adapterFactory) {
    return new Retrofit.Builder()
            .baseUrl(mBaseUrl)
            .addConverterFactory(converterFactory)
            .addCallAdapterFactory(adapterFactory)
            .client(client)
            .build();
}
 
Example 12
Project: fast-list   File: AppModule.java   View source code 5 votes vote down vote up
@Singleton
@Provides
@Named("fresco_ok_http")
OkHttpClient provideFrescoOkHttpClient() {
  return new OkHttpClient.Builder()
      .readTimeout(30, TimeUnit.SECONDS)
      .writeTimeout(30, TimeUnit.SECONDS)
      .connectTimeout(30, TimeUnit.SECONDS)
      .followRedirects(true)
      .build();
}
 
Example 13
Project: ProjectAres   File: MapLoaderImpl.java   View source code 5 votes vote down vote up
@Inject MapLoaderImpl(Loggers loggers, @Named("serverRoot") Path serverRoot, MapConfiguration config, PGMMap.Factory mapFactory, MapErrorTracker mapErrorTracker) {
    this.mapErrorTracker = mapErrorTracker;
    this.logger = loggers.get(getClass());
    this.serverRoot = serverRoot;
    this.config = checkNotNull(config);
    this.mapFactory = mapFactory;
}
 
Example 14
Project: OperatieBRP   File: RedenVerkrijgingNLNationaliteitController.java   View source code 5 votes vote down vote up
/**
 * Constructor.
 * @param repository repository
 */
@Inject
protected RedenVerkrijgingNLNationaliteitController(
        @Named("redenVerkrijgingNLNationaliteitRepository") final ReadWriteRepository<RedenVerkrijgingNLNationaliteit, Short> repository) {
    super(repository,
            Arrays.asList(
                    new Filter<>(OMSCHRIJVING, new StringValueAdapter(), new LikePredicateBuilderFactory(OMSCHRIJVING)),
                    new Filter<>(CODE, new StringValueAdapter(), new EqualPredicateBuilderFactory(CODE))),
            Collections.emptyList(),
            Arrays.asList(CODE, OMSCHRIJVING));
}
 
Example 15
Project: Lagerta   File: SubscriberConsumer.java   View source code 5 votes vote down vote up
@Inject
public SubscriberConsumer(
    LeadService lead,
    Serializer serializer,
    Committer committer,
    TransactionsBuffer buffer,
    DoneNotifier doneNotifier,
    FullCommitHandler fullCommitHandler,
    DeserializerClosure deserializerClosure,
    BufferOverflowCondition bufferOverflowCondition,
    KafkaFactory kafkaFactory,
    DataRecoveryConfig dataRecoveryConfig,
    @Named(DataCapturerBusConfiguration.NODE_ID) UUID consumerId,
    OnKafkaStop onKafkaStop
) {
    this.lead = lead;
    this.serializer = serializer;
    this.committer = committer;
    this.buffer = buffer;
    this.doneNotifier = doneNotifier.setBuffer(buffer);
    this.fullCommitHandler = fullCommitHandler.setBuffer(buffer);
    this.deserializerClosure = deserializerClosure.setBuffer(buffer);
    this.bufferOverflowCondition = bufferOverflowCondition;
    consumer = kafkaFactory.consumer(dataRecoveryConfig.getConsumerConfig(), onKafkaStop);

    this.consumerId = consumerId;
    remoteTopic = dataRecoveryConfig.getRemoteTopic();
    reconciliationTopic = dataRecoveryConfig.getReconciliationTopic();
}
 
Example 16
Project: android-training-2017   File: UserEndpoint.java   View source code 5 votes vote down vote up
/**
 * Updates an existing {@code User}.
 *
 * @param id   the ID of the entity to be updated
 * @param user the desired state of the entity
 * @return the updated version of the entity
 * @throws NotFoundException if the {@code id} does not correspond to an existing
 *                           {@code User}
 */
@ApiMethod(
        name = "update",
        path = "user/{id}",
        httpMethod = ApiMethod.HttpMethod.PUT)
public User update(@Named("id") Long id, User user) throws NotFoundException {
    // TODO: You should validate your ID parameter against your resource's ID here.
    checkExists(id);
    ofy().save().entity(user).now();
    logger.info("Updated User: " + user);
    return ofy().load().entity(user).now();
}
 
Example 17
Project: Aurora   File: ClientModule.java   View source code 5 votes vote down vote up
/**
 * 提供 {@link RxCache}
 *
 * @param cacheDirectory RxCache缓存路径
 * @return
 */
@Singleton
@Provides
RxCache provideRxCache(Application application, @Nullable RxCacheConfiguration configuration, @Named("RxCacheDirectory") File cacheDirectory) {
    RxCache.Builder builder = new RxCache.Builder();
    RxCache rxCache = null;
    if (configuration != null) {
        rxCache = configuration.configRxCache(application, builder);
    }
    if (rxCache != null) return rxCache;
    return builder
            .persistence(cacheDirectory, new GsonSpeaker());
}
 
Example 18
Project: OperatieBRP   File: SoortVrijBerichtController.java   View source code 5 votes vote down vote up
/**
 * Constructor.
 * @param repository repository
 */
@Inject
protected SoortVrijBerichtController(@Named("soortVrijBerichtRepository") final ReadWriteRepository<SoortVrijBericht, Short> repository) {
    super(repository,
            Collections.singletonList(new Filter<>(NAAM, new StringValueAdapter(), new LikePredicateBuilderFactory(NAAM))),
            Collections.emptyList(),
            Collections.singletonList(NAAM));
}
 
Example 19
Project: fpm   File: CoastlineGenerator.java   View source code 5 votes vote down vote up
@Inject
public CoastlineGenerator(@Named("com.mappy.fpm.coastline.tomtomFolder") String tomtomFolder, //
                          @Named("com.mappy.fpm.coastline.workspace") String workspace, //
                          OsmosisSerializer serializer) {
    this.tomtomFolder = tomtomFolder;
    this.workspace = workspace;
    this.serializer = serializer;
}
 
Example 20
Project: AndroidSensors   File: RawGPSMeasurementsGatherer.java   View source code 5 votes vote down vote up
@Inject
public RawGPSMeasurementsGatherer(SensorConfig sensorConfig,
                                  LocationManager locationManager,
                                  @Named("gpsSensorEnableRequester") SensorEnableRequester sensorEnableRequester,
                                  @Named("fineLocationPermissionChecker") PermissionChecker permissionChecker,
                                  @Named("rawGPSSensorChecker") SensorChecker sensorChecker,
                                  SensorRequirementChecker sensorRequirementChecker) {

    super(sensorConfig, locationManager,
            sensorEnableRequester, permissionChecker, sensorChecker, sensorRequirementChecker);
}
 
Example 21
Project: Aurora   File: ClientModule.java   View source code 5 votes vote down vote up
/**
 * 需要单独给 {@link RxCache} 提供缓存路径
 *
 * @param cacheDir
 * @return
 */
@Singleton
@Provides
@Named("RxCacheDirectory")
File provideRxCacheDirectory(File cacheDir) {
    File cacheDirectory = new File(cacheDir, "RxCache");
    return DataHelper.makeDirs(cacheDirectory);
}
 
Example 22
Project: verify-matching-service-adapter   File: MetadataCertificateValidator.java   View source code 5 votes vote down vote up
@Inject
public MetadataCertificateValidator(
        MetadataResolver metadataResolver,
        MetadataCertificatesRepository metadataCertificatesRepository,
        @Named("HubEntityId") String hubEntityId,
        @Named("HubFederationId") String hubFederationId) {
    this.metadataResolver = metadataResolver;
    this.metadataCertificatesRepository = metadataCertificatesRepository;
    this.hubEntityId = hubEntityId;
    this.hubFederationId = hubFederationId;
}
 
Example 23
Project: MVVMArms   File: ClientModule.java   View source code 5 votes vote down vote up
/**
 * 提供 {@link RxCache}
 *
 * @param cacheDirectory RxCache 缓存路径
 * @return RxCache
 */
@Singleton
@Provides
RxCache provideRxCache(@Nullable RxCacheConfiguration configuration, @Named("RxCacheDirectory") File cacheDirectory) {
    RxCache.Builder builder = new RxCache.Builder();
    RxCache rxCache = null;
    if (configuration != null) {
        rxCache = configuration.configRxCache(mApplication, builder);
    }
    if (rxCache != null) {
        return rxCache;
    }
    return builder.persistence(cacheDirectory, new GsonSpeaker());
}
 
Example 24
Project: verify-hub   File: HubAsIdpMetadataHandler.java   View source code 5 votes vote down vote up
@Inject
public HubAsIdpMetadataHandler(
        MetadataResolver metadataResolver,
        SamlProxyConfiguration samlProxyConfiguration,
        @Named("HubEntityId") String hubEntityId,
        @Named("HubFederationId") String hubFederationId) {

    this.samlProxyConfiguration = samlProxyConfiguration;
    this.metadataResolver = metadataResolver;
    this.hubEntityId = hubEntityId;
    this.hubFederationId = hubFederationId;
}
 
Example 25
Project: OperatieBRP   File: ConversieRedenBeeindigenNationaliteitController.java   View source code 5 votes vote down vote up
/**
 * Constructor.
 * @param repository repository
 */
@Inject
protected ConversieRedenBeeindigenNationaliteitController(
    @Named("conversieRedenBeeindigenNationaliteitRepository") final ReadWriteRepository<RedenBeeindigingNationaliteit, Integer> repository) {
    super(repository,
            Arrays.asList(
                    new Filter<>(LO3_OMSCHRIJVING, new StringValueAdapter(), new LikePredicateBuilderFactory(LO3_OMSCHRIJVING)),
                    new Filter<>(REDEN_VERLIES_NATIONALITEIT, new StringValueAdapter(), new EqualPredicateBuilderFactory(REDEN_VERLIES_NATIONALITEIT)),
                    new Filter<>(REDEN_VERLIES_NATIONALITEIT_ID, new ShortValueAdapter(),
                            new EqualPredicateBuilderFactory(REDEN_VERLIES_NATIONALITEIT_ID))),
            null,
            Arrays.asList(LO3_OMSCHRIJVING, REDEN_VERLIES_NATIONALITEIT));
}
 
Example 26
Project: OperatieBRP   File: AanduidingInhoudingVermissingReisdocumentController.java   View source code 5 votes vote down vote up
/**
 * Constructor.
 * @param repository repository
 */
@Inject
protected AanduidingInhoudingVermissingReisdocumentController(
        @Named("aanduidingInhoudingVermissingReisdocumentRepository") final ReadWriteRepository<AanduidingInhoudingOfVermissingReisdocument, Short>
                repository) {
    super(repository, Collections.<Filter<?>>emptyList(), null, SORTERINGEN);
}
 
Example 27
Project: AndroidBlueprints   File: MessageViewModel.java   View source code 5 votes vote down vote up
@Inject
public MessageViewModel(MessageRepository messageRepository,
                        @Named("vm") CompositeDisposable compositeDisposable) {
    Timber.d("Init MessageViewModel");
    this.repository = messageRepository;
    this.compositeDisposable = compositeDisposable;
    this.messageIdentifier = new Identifier();
    this.subject = PublishSubject.create();
    this.messages = new MutableLiveData<>();
}
 
Example 28
Project: Java-9-Programming-By-Example   File: ColorManager.java   View source code 5 votes vote down vote up
@Inject
public ColorManager(@Named("nrColors") int nrColors, ColorFactory factory) {
    log.log(DEBUG,"creating colorManager for {0} colors",nrColors);
    this.nrColors = nrColors;
    this.factory = factory;
    createOrdering();
}
 
Example 29
Project: vars-annotation   File: WebPreferencesFactory.java   View source code 5 votes vote down vote up
@Inject
public WebPreferencesFactory(PreferencesService service, @Named("PREFS_TIMEOUT") Long timeoutMillis) {
    Preconditions.checkNotNull(service, "Missing a PreferencesService");
    Preconditions.checkNotNull(timeoutMillis, "Missing a timeout argument");
    Preconditions.checkArgument(timeoutMillis > 100, "The timeout was less than 100 ms. This isn't allowed.");
    this.systemRoot = new WebPreferences(service, timeoutMillis, null, "");
}
 
Example 30
Project: Impala   File: ApiModule.java   View source code 4 votes vote down vote up
@Provides
@Singleton
@Named("LOGIN_URL")
String provideLoginApiUrl() {
    return Constants.LOGIN_URL;
}
 
Example 31
Project: clustercode   File: ConfigurableCleanupStrategy.java   View source code 4 votes vote down vote up
@Inject
ConfigurableCleanupStrategy(Set<CleanupProcessor> cleanupProcessors,
                            @Named(CleanupModule.CLEANUP_STRATEGY_KEY) String strategies) {
    this.processors = ModuleHelper.sortImplementations(strategies, cleanupProcessors, CleanupProcessors::valueOf);
}
 
Example 32
Project: GitHub   File: ApiModule.java   View source code 4 votes vote down vote up
@Singleton
@Named("hotViralImages")
@Provides
Observable<List<Image>> provideHotViralImages(ImgurObservables imgurObservables) {
  return imgurObservables.getHotViralImages(5 /*maxPages*/);
}
 
Example 33
Project: verify-hub   File: MatchingServiceHealthcheckRequestGeneratorService.java   View source code 4 votes vote down vote up
@Inject
public MatchingServiceHealthcheckRequestGeneratorService(AttributeQueryGenerator<MatchingServiceHealthCheckRequest> attributeQueryGenerator,
                                                         @Named("HubEntityId") String hubEntityId) {
    this.attributeQueryGenerator = attributeQueryGenerator;
    this.hubEntityId = hubEntityId;
}
 
Example 34
Project: clustercode   File: ConfigurableMatcherStrategy.java   View source code 4 votes vote down vote up
@Inject
ConfigurableMatcherStrategy(@Named(ScanModule.PROFILE_STRATEGY_KEY) String strategies,
                            Set<ProfileMatcher> matchers) {
    this.matchers = ModuleHelper.sortImplementations(strategies, matchers, ProfileMatchers::valueOf);
}
 
Example 35
Project: thirdcoast   File: ClosedLoopMenuModule.java   View source code 4 votes vote down vote up
@Binds
@IntoSet
@Named("TALON_CONFIG_CL")
public abstract Command motionMagicCruiseVelocityCommand(
    MotionMagicCruiseVelocityCommand command);
 
Example 36
Project: thirdcoast   File: LimitMenuModule.java   View source code 4 votes vote down vote up
@Binds
@IntoSet
@Named("TALON_CONFIG_LIM")
public abstract Command enableForwardSoftLimitCommand(EnableForwardSoftLimitCommand command);
 
Example 37
Project: thirdcoast   File: MenuModule.java   View source code 4 votes vote down vote up
@Binds
@Singleton
@IntoSet
@Named("MAIN")
public abstract Command servoModeCommand(ServoModeCommand command);
 
Example 38
Project: servicebuilder   File: AppTokenClientFilter.java   View source code 4 votes vote down vote up
@Inject
public AppTokenClientFilter(@Named(APP_TOKEN_SUPPLIER_BIND_NAME) Supplier<String> appTokenSupplier) {
    this.appTokenSupplier = appTokenSupplier;
}
 
Example 39
Project: fpm   File: Geonames.java   View source code 4 votes vote down vote up
@Inject
public Geonames(@Named("com.mappy.fpm.geonames") String path) {
    alternateNames = alternateNames(path + "/alternateNames.txt");
    idByCountry = idByCountry(path + "/countryInfo.txt");
}
 
Example 40
Project: OperatieBRP   File: DBUnitBrpUtil.java   View source code 4 votes vote down vote up
/**
 * Constructor.
 * @param dataSource datasource
 */
@Inject
public DBUnitBrpUtil(@Named("syncDalDataSource") final DataSource dataSource) throws DataSetException {
    this.dataSource = dataSource;
    initTabellen();
}