Java Code Examples for javax.inject.Inject

The following are top voted examples for showing how to use javax.inject.Inject. 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: hrrs   File: RateLimitedExecutor.java   View source code 6 votes vote down vote up
@Inject
public RateLimitedExecutor(Config config) {

    // Check arguments.
    checkNotNull(config, "config");

    // Set class fields.
    this.executorService = createExecutorService(config.getThreadCount());
    this.rateLimiter = RateLimiter.create(
            config.getMaxRequestCountPerSecond(),
            config.getRampUpDurationSeconds(),
            TimeUnit.SECONDS);
    LOGGER.debug(
            "instantiated (threadCount={}, maxRequestCountPerSecond={}, rampUpDurationSeconds={})",
            config.getThreadCount(), config.getMaxRequestCountPerSecond(), config.getRampUpDurationSeconds());

}
 
Example 2
Project: Equella   File: TLEAclManagerImpl.java   View source code 6 votes vote down vote up
@Inject
public void setPluginService(PluginService pluginService)
{
	ownerHandlers = new PluginTracker<SecurityTargetHandler>(pluginService, "com.tle.core.security",
		"securityTargetHandler", "handlesOwnershipFor");
	ownerHandlers.setBeanKey("handler");

	labellingHandlers = new PluginTracker<SecurityTargetHandler>(pluginService, "com.tle.core.security",
		"securityTargetHandler", "handlesLabellingFor");
	labellingHandlers.setBeanKey("handler");

	transformHandlers = new PluginTracker<SecurityTargetHandler>(pluginService, "com.tle.core.security",
		"securityTargetHandler", "handlesTransformationOf");
	transformHandlers.setBeanKey("handler");

	postProcessors = new PluginTracker<SecurityPostProcessor>(pluginService, "com.tle.core.security", "securityPostProcessor",
		null).setBeanKey("bean");
}
 
Example 3
Project: ProjectAres   File: ServerTagger.java   View source code 6 votes vote down vote up
@Inject ServerTagger(Server server) {
    this.tags = Lazy.from(() -> {
        final TagSetBuilder builder = new TagSetBuilder();
        builder
            .add("server", server.slug())
            .add("datacenter", server.datacenter())
            .add("box", server.box())
            .add("network", server.network().name().toLowerCase())
            .add("role", server.role().name().toLowerCase())
            .add("visibility", server.visibility().name().toLowerCase())
            .add("family", server.family())
            .addAll("realm", server.realms());

        if(server.game_id() != null) {
            builder.add("game", server.game_id());
        }

        return builder.build();
    });
}
 
Example 4
Project: fx-animation-editor   File: AnimationEditorComponent.java   View source code 6 votes vote down vote up
@Inject
public AnimationEditorComponent(MenuBarComponent menuBar, AnimationEditorPresenter presenter, TimelineEditorComponent timelineEditor,
                                PropertyEditorComponent propertyEditor, SceneComponent scene, PlayerComponent player, PropertyStore propertyStore,
                                SaveDialogComponent saveDialogComponent, EventBus eventBus) {

    this.menuBar = menuBar;
    this.timelineEditor = timelineEditor;
    this.propertyEditor = propertyEditor;
    this.scene = scene;
    this.player = player;
    this.propertyStore = propertyStore;
    this.saveDialogComponent = saveDialogComponent;
    initUi();
    initPresenter(presenter);
    configureDividerPosition();
    subscribeToEvents(eventBus);
}
 
Example 5
Project: hygene   File: SimpleBookmarkStore.java   View source code 6 votes vote down vote up
/**
 * Create an instance of a {@link SimpleBookmarkStore}.
 * <p>
 * If it observed that the {@link org.dnacronym.hygene.parser.GfaFile} in {@link GraphStore} has changed, it will
 * clear all current {@link SimpleBookmark}s and load the {@link Bookmark}s associated with the new
 * {@link org.dnacronym.hygene.parser.GfaFile}.
 * <p>
 * It uses the {@link GraphDimensionsCalculator} as a reference for each internal {@link SimpleBookmark}.
 *
 * @param graphStore                the {@link GraphStore} to be observed by this class
 * @param graphVisualizer           the {@link GraphVisualizer} to be used by this class
 * @param graphDimensionsCalculator the {@link GraphDimensionsCalculator} to be used by this class
 * @param sequenceVisualizer        the {@link SequenceVisualizer} to be used by this class
 * @see SimpleBookmark
 */
@Inject
public SimpleBookmarkStore(final GraphStore graphStore, final GraphVisualizer graphVisualizer,
                           final GraphDimensionsCalculator graphDimensionsCalculator,
                           final SequenceVisualizer sequenceVisualizer) {
    this.graphDimensionsCalculator = graphDimensionsCalculator;
    this.graphVisualizer = graphVisualizer;
    this.sequenceVisualizer = sequenceVisualizer;

    simpleBookmarks = new ArrayList<>();
    observableSimpleBookmarks = FXCollections.observableList(simpleBookmarks);
    observableSimpleBookmarks.addListener((ListChangeListener<SimpleBookmark>) listener -> graphVisualizer.draw());

    graphStore.getGfaFileProperty().addListener((observable, oldValue, newValue) -> {
        try {
            fileBookmarks = new FileBookmarks(new FileDatabase(newValue.getFileName()));

            simpleBookmarks.clear();
            addBookmarks(fileBookmarks.getAll());
        } catch (final SQLException | IOException e) {
            LOGGER.error("Unable to load bookmarks from file.", e);
        }
    });
}
 
Example 6
Project: AndroidSensors   File: WifiMeasurementsGatherer.java   View source code 5 votes vote down vote up
@Inject
public WifiMeasurementsGatherer(SensorConfig sensorConfig,
                                WifiManager wifiManager,
                                @Named("wifiSensorEnableRequester")SensorEnableRequester sensorEnableRequester,
                                @Named("fineLocationPermissionChecker") PermissionChecker permissionChecker,
                                @Named("wifiSensorChecker")SensorChecker sensorChecker,
                                SensorRequirementChecker sensorRequirementChecker,
                                Context context){
    super(sensorConfig, sensorEnableRequester, permissionChecker, sensorChecker, sensorRequirementChecker);
    this.wifiManager = wifiManager;
    this.context = context;
}
 
Example 7
Project: Re-Collector   File: MessageBufferConfiguration.java   View source code 5 votes vote down vote up
@Inject
public MessageBufferConfiguration(Config config) {
    if (config.hasPath("message-buffer-size")) {
        this.size = config.getInt("message-buffer-size");
    } else {
        this.size = SIZE;
    }
}
 
Example 8
Project: MDRXL   File: GeraltWomanPhotosPresenter.java   View source code 5 votes vote down vote up
@Inject
GeraltWomanPhotosPresenter(final RxLoaderManager loaderManager,
                           final GeraltWomanPhotoLoaderFactory loaderFactory,
                           final CommandStarter commandStarter,
                           final MessageFactory messageFactory,
                           final ResourcesManager resourcesManager,
                           @WomanId final long womanId) {
    super(loaderManager);
    this.loaderFactory = loaderFactory;
    this.commandStarter = commandStarter;
    this.messageFactory = messageFactory;
    this.resourcesManager = resourcesManager;
    this.womanId = womanId;
}
 
Example 9
Project: Nird2   File: IntroducerManager.java   View source code 5 votes vote down vote up
@Inject
IntroducerManager(MessageSender messageSender, ClientHelper clientHelper,
		Clock clock, CryptoComponent cryptoComponent,
		IntroductionGroupFactory introductionGroupFactory) {

	this.messageSender = messageSender;
	this.clientHelper = clientHelper;
	this.clock = clock;
	this.cryptoComponent = cryptoComponent;
	this.introductionGroupFactory = introductionGroupFactory;
}
 
Example 10
Project: gitplex-mit   File: DefaultPullRequestReferenceManager.java   View source code 5 votes vote down vote up
@Inject
public DefaultPullRequestReferenceManager(Dao dao, UserManager userManager, 
		MarkdownManager markdownManager) {
	super(dao);
	this.markdownManager = markdownManager;
	this.userManager = userManager;
}
 
Example 11
Project: eggs-android   File: SplashInteractor.java   View source code 5 votes vote down vote up
@Inject
public SplashInteractor(@ApplicationContext Context context,
                        PreferencesHelper preferencesHelper,
                        ApiHelper apiHelper) {

    super(preferencesHelper, apiHelper);
    mContext = context;
}
 
Example 12
Project: Nird2   File: ForumControllerImpl.java   View source code 5 votes vote down vote up
@Inject
ForumControllerImpl(@DatabaseExecutor Executor dbExecutor,
		LifecycleManager lifecycleManager, IdentityManager identityManager,
		@CryptoExecutor Executor cryptoExecutor,
		ForumManager forumManager, ForumSharingManager forumSharingManager,
		EventBus eventBus, Clock clock, MessageTracker messageTracker,
		AndroidNotificationManager notificationManager) {
	super(dbExecutor, lifecycleManager, identityManager, cryptoExecutor,
			eventBus, clock, notificationManager, messageTracker);
	this.forumManager = forumManager;
	this.forumSharingManager = forumSharingManager;
}
 
Example 13
Project: PicShow-zhaipin   File: LoginPresenter.java   View source code 5 votes vote down vote up
@Inject
public LoginPresenter(LoginContract.Model model, LoginContract.View rootView
        , RxErrorHandler handler, Application application
        , ImageLoader imageLoader, AppManager appManager) {
    super(model, rootView);
    this.mErrorHandler = handler;
    this.mApplication = application;
    this.mImageLoader = imageLoader;
    this.mAppManager = appManager;
}
 
Example 14
Project: ProjectAres   File: MatchPlayerExecutor.java   View source code 5 votes vote down vote up
@Inject MatchPlayerExecutor(SyncExecutor syncExecutor, Match match, UUID uuid) {
    super(syncExecutor);
    this.uuid = uuid;

    if(!match.isUnloaded()) {
        this.match = match;
        this.match.registerEvents(this);
    }
}
 
Example 15
Project: dagger-test-example   File: TomorrowWeatherViewModel.java   View source code 5 votes vote down vote up
@Inject @Replaceable
public TomorrowWeatherViewModel(NavigationController navigation,
                                @RxObservable(PAGE) Observable<Integer> pageChangeObservable,
                                PermissionService permissionService,
                                LocationService locationService,
                                WeatherService weatherService,
                                TomorrowWeatherResponseFilter weatherParser,
                                @RxScheduler(MAIN) Scheduler androidScheduler) {
    super(navigation, pageChangeObservable, permissionService, locationService, weatherService, weatherParser, androidScheduler);
}
 
Example 16
Project: OperatieBRP   File: ReisdocumentStandaardMutatieVerwerker.java   View source code 5 votes vote down vote up
/**
 * Constructor.
 * @param mapper mapper
 * @param attribuutConverteerder attributen converteerder
 * @param historieNabewerking historie nabewerking
 */
@Inject
protected ReisdocumentStandaardMutatieVerwerker(
        final ReisdocumentMapper mapper,
        final BrpAttribuutConverteerder attribuutConverteerder,
        final PersoonReisdocumentHistorieNabewerking historieNabewerking) {
    super(mapper, new ReisdocumentConverteerder(attribuutConverteerder), attribuutConverteerder, historieNabewerking, ReisdocumentMapper.GROEP_ELEMENT,
            LOGGER);
}
 
Example 17
Project: fernet-java8   File: RedisKeyRepository.java   View source code 5 votes vote down vote up
/**
 * @param pool connection to Redis
 */
@Inject
public RedisKeyRepository(final JedisPool pool) {
    if (pool == null) {
        throw new IllegalArgumentException("pool cannot be null");
    }
    this.pool = pool;
}
 
Example 18
Project: SimpleCalculator   File: CalculatorPresenterImpl.java   View source code 5 votes vote down vote up
@Inject
CalculatorPresenterImpl(CalculateOperationsInteractor interactorCalculateOperations,
                        CharactersValidator validator,
                        StringTransformator transformator,
                        ParseInputInteractor interactorParseInput) {
    this.interactorCalculations = interactorCalculateOperations;
    this.interactorParseInput = interactorParseInput;
    this.validator = validator;
    this.transformator = transformator;
}
 
Example 19
Project: Re-Collector   File: DatabaseInputConfiguration.java   View source code 5 votes vote down vote up
@Inject
public DatabaseInputConfiguration(@Assisted String id,
                                  @Assisted Config config,
                                  DatabaseInput.Factory inputFactory) {
    super(id, config);
    this.inputFactory = inputFactory;
    if (config.hasPath("db-driver")) {
        this.dbDriver = config.getString("db-driver");
    }
    if (config.hasPath("db-connection-url")) {
        this.dbConnectionUrl = config.getString("db-connection-url");
    }
    if (config.hasPath("sql")) {
        this.sql = config.getString("sql");
    }
    if (config.hasPath("key-type")) {
        this.keytype = config.getString("key-type");
    }
    if (config.hasPath("id-field")) {
        this.idfield = config.getString("id-field");
    }
    if (config.hasPath("db-driver-path")) {
        this.dbDriverPath = config.getString("db-driver-path");
    }
    if (config.hasPath("init-sql")) {
        this.initSql = config.getString("init-sql");
    }
    if (config.hasPath("db-user")) {
        this.dbUser = config.getString("db-user");
    }
    if (config.hasPath("db-password")) {
        this.dbPassword = config.getString("db-password");
    }
    if (config.hasPath("db-sync-time")) {
        this.dbSyncTime = config.getInt("db-sync-time");
    } else {
        this.dbSyncTime = 1;
    }
}
 
Example 20
Project: server-vot   File: AddMachineRouter.java   View source code 5 votes vote down vote up
@Inject
public AddMachineRouter(ServiceResponse serviceResponse,
                        AddMachineService service, EndpointProtector protector) {
    super(serviceResponse);
    this.service = service;
    this.protector = protector;
}
 
Example 21
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 22
Project: ProjectAres   File: MatchExecutor.java   View source code 5 votes vote down vote up
@Inject MatchExecutor(SyncExecutor executor, Match match) {
    super(executor);

    if(!match.isUnloaded()) {
        this.match = match;
        this.match.registerEvents(this);
    }
}
 
Example 23
Project: ProjectAres   File: DynamicScheduler.java   View source code 5 votes vote down vote up
@Inject DynamicScheduler(Match match, FeatureDefinitionContext fdc) {
    this.match = match;

    // Process dynamics in lexical order
    final Comparator<Dynamic> order = Comparator.comparing(Dynamic::getDefinition, fdc);
    this.clearQueue = new PriorityQueue<>(order);
    this.placeQueue = new PriorityQueue<>(order);
}
 
Example 24
Project: mvvm-template   File: FeedViewModel.java   View source code 5 votes vote down vote up
@Inject
public FeedViewModel(UserManager userManager, FeedRepo repo, UserRestService userRestService) {
    super(userManager);
    this.userRestService = userRestService;
    this.feedRepo = repo;
    refresh(300);
}
 
Example 25
Project: fpm   File: Maneuvers.java   View source code 5 votes vote down vote up
@Inject
public Maneuvers(MpDbf mpDbf, MnDbf mnDbf) {
    Map<Long, List<ManeuverPath>> mpById = mpDbf.paths().stream().sorted(Comparator.comparing(ManeuverPath::getSeqnr)).collect(groupingBy(ManeuverPath::getId));
    for (Maneuver maneuver : mnDbf.maneuvers()) {
        List<ManeuverPath> path = mpById.get(maneuver.getId());
        List<Long> segments = path.stream().map(ManeuverPath::getTrpelId).collect(toList());
        checkState(segments.size() > 1);
        restrictionRoadIds.addAll(segments);
        restrictions.add(new Restriction(segments, maneuver.getJunctionId()));
    }
    log.info("{} maneuvers found", restrictions.size());
}
 
Example 26
Project: Equella   File: BulkMoveContentOperation.java   View source code 5 votes vote down vote up
@Inject
public MoveContentOperationExecutor(@Assisted("courseId") String courseId,
	@Assisted("locationId") String locationId)
{
	this.courseId = courseId;
	this.locationId = locationId;
}
 
Example 27
Project: ceidg-captcha   File: CEIDGCaptchaMachineLearningRunner.java   View source code 5 votes vote down vote up
@Inject
public CEIDGCaptchaMachineLearningRunner(MultiLayerConfigurationFactory multiLayerConfigurationFactory,
                                         MachineLearningService machineLearningService,
                                         MultiLayerNetworkFactory multiLayerNetworkFactory,
                                         MultiLayerNetworkSaver multiLayerNetworkSaver) {
    this.multiLayerConfigurationFactory = multiLayerConfigurationFactory;
    this.machineLearningService = machineLearningService;
    this.multiLayerNetworkFactory = multiLayerNetworkFactory;
    this.multiLayerNetworkSaver = multiLayerNetworkSaver;
}
 
Example 28
Project: dragoman   File: VertxSubscriptionManager.java   View source code 5 votes vote down vote up
@Inject
public VertxSubscriptionManager(
    Vertx vertx, DatasetDao datasetDao, Reader reader, AsOfFactory asOfFactory) {
  this.vertx = vertx;
  this.datasetDao = datasetDao;
  this.reader = reader;
  this.asOfFactory = asOfFactory;
  this.subscriptions = new ConcurrentHashMap<>();
  this.executor = vertx.createSharedWorkerExecutor("subscription-manager");
}
 
Example 29
Project: Equella   File: DownloadPackageViewer.java   View source code 5 votes vote down vote up
@Inject
public void setPluginService(PluginService pluginService)
{
	downloadLink = new PluginTracker<ItemUrlExtender>(pluginService,
		"com.tle.web.viewitem.treeviewer", "downloadLink", "id");
	downloadLink.setBeanKey("class");
}
 
Example 30
Project: verify-hub   File: CountriesResource.java   View source code 5 votes vote down vote up
@Inject
public CountriesResource(
        ConfigEntityDataRepository<CountriesConfigEntityData> countriesConfigEntityDataRepository,
        ExceptionFactory exceptionFactory
) {
    this.countriesConfigEntityDataRepository = countriesConfigEntityDataRepository;
    this.exceptionFactory = exceptionFactory;
}
 
Example 31
Project: webpoll   File: RepositoryFactoryImpl.java   View source code 5 votes vote down vote up
@Inject
public RepositoryFactoryImpl(Instance<SurveyRepository> surveyRepository,
                             Instance<UserRepository> userRepository,
                             Instance<ResponseRepository> responseRepository) {
    this.surveyRepository = surveyRepository;
    this.userRepository = userRepository;
    this.responseRepository = responseRepository;
}
 
Example 32
Project: oscm   File: SubscriptionServiceMockBase.java   View source code 5 votes vote down vote up
static void mockInjects(Object instance) throws Exception {
    for (Field f : instance.getClass().getDeclaredFields()) {
        Inject injected = f.getAnnotation(Inject.class);
        if (injected != null) {
            Class<?> t = f.getType();
            f.set(instance, mock(t));
        }
    }
}
 
Example 33
Project: beadledom   File: ShutdownHookModule.java   View source code 5 votes vote down vote up
@Inject
public SystemShutdownHook(final LifecycleShutdownManager shutdownManager) {
  Runtime.getRuntime().addShutdownHook(new Thread() {
    @Override
    public void run() {
      shutdownManager.shutdown();
    }
  });
}
 
Example 34
Project: ProjectAres   File: MapLogger.java   View source code 4 votes vote down vote up
@Inject MapLogger(@Assisted MapDefinition map, MapdevLogger mapdevLogger) {
    super(mapdevLogger.getName() + "." + map.getDottedPath(), null);
    this.map = map;
    setParent(mapdevLogger);
    setUseParentHandlers(true);
}
 
Example 35
Project: mvparms   File: ImageLoader.java   View source code 4 votes vote down vote up
@Inject //通过注解进行初始化
public ImageLoader(BaseImageLoaderStrategy strategy) {
    setLoadImgStrategy(strategy);
}
 
Example 36
Project: webpoll   File: SurveyOverviewServiceImpl.java   View source code 4 votes vote down vote up
@Inject
public SurveyOverviewServiceImpl(RepositoryFactory repositoryFactory, SecurityAdapter securityAdapter) {
	this.repositoryFactory = repositoryFactory;
	this.securityAdapter = securityAdapter;
}
 
Example 37
Project: open-kilda   File: KafkaConfig.java   View source code 4 votes vote down vote up
@Inject
public KafkaConfig(@Named("kafka.host") String host, @Named("kafka.port") Integer port) {
	this.host = host;
	this.port = port;
}
 
Example 38
Project: Reer   File: DefaultSettings.java   View source code 4 votes vote down vote up
@Inject
public PluginManagerInternal getPluginManager() {
    throw new UnsupportedOperationException();
}
 
Example 39
Project: dagger2-sample   File: AddMenuBalancePresenter2.java   View source code 4 votes vote down vote up
@Inject
AddMenuBalancePresenter2(IAddMenuBalanceView view, MenuBalanceRepository2 mMenuBalanceRepository) {
    this.mView = view;
    this.mMenuBalanceRepository = mMenuBalanceRepository;
}
 
Example 40
Project: bitflyer4j   File: Bitflyer4jImpl.java   View source code 4 votes vote down vote up
@Inject
public Bitflyer4jImpl(Injector i) {

    injector = i;

    environment = injector.getInstance(Environment.class);

    marketService = injector.getInstance(MarketService.class);

    accountService = injector.getInstance(AccountService.class);

    orderService = injector.getInstance(OrderService.class);

    realtimeService = injector.getInstance(RealtimeService.class);

    log.info("Initialized : {} - {}", getVersion(), getSite());

}