当前位置: 首页>>代码示例>>Java>>正文


Java Injector类代码示例

本文整理汇总了Java中play.inject.Injector的典型用法代码示例。如果您正苦于以下问题:Java Injector类的具体用法?Java Injector怎么用?Java Injector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Injector类属于play.inject包,在下文中一共展示了Injector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExpander

import play.inject.Injector; //导入依赖的package包/类
public static EntityExpander getExpander(Configuration expanderConfig,
                                         Injector injector,
                                         RequestContext requestContext) {
    JsonNode reqBody = requestContext.getRequestBody();
    String modelName = expanderConfig.getString("modelName");
    String modelFile = expanderConfig.getString("modelFile");
    List<String> attrNames = JsonHelpers.getOptionalStringList(reqBody,
            expanderConfig.getString("attrNamesKey"),
            expanderConfig.getStringList("attrNames"));
    Configuration daoConfigs = expanderConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get());
    double sampleRate = 1.0;
    if (expanderConfig.asMap().containsKey("sampleRate")) {
        sampleRate = expanderConfig.getDouble("sampleRate");
    }
    int maxNumValues = 100;
    if (expanderConfig.asMap().containsKey("maxNumValues")) {
        maxNumValues = expanderConfig.getInt("maxNumValues");
    }
    ModelManager modelManager = new PercentileModelManager(modelName, modelFile, injector,
            attrNames, maxNumValues, sampleRate, expanderConfig.getConfig("attrName2Config"),
            expanderConfig.getString("daoConfigKey"), daoConfigs);
    PercentileModel model = (PercentileModel) modelManager.manage(requestContext);
    return new PercentileExpander(expanderConfig.getStringList("attrNames"), model);
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:25,代码来源:PercentileExpander.java

示例2: getEntityExpanders

import play.inject.Injector; //导入依赖的package包/类
static public List<EntityExpander> getEntityExpanders(RequestContext requestContext,
                                                      List<Configuration> expandersConfig,
                                                      Injector injector) {
    try {
        List<EntityExpander> resultExpanders = new ArrayList<>(expandersConfig.size());
        for (Configuration expanderConfig : expandersConfig) {
            Method method = Class.forName(expanderConfig.getString(ConfigKey.EXPANDER_CLASS.get()))
                    .getMethod("getExpander", Configuration.class, Injector.class, RequestContext.class);
            EntityExpander expander = (EntityExpander) method
                    .invoke(null, expanderConfig, injector, requestContext);
            resultExpanders.add(expander);
        }
        return resultExpanders;
    } catch (IllegalAccessException | InvocationTargetException
            | NoSuchMethodException | ClassNotFoundException e) {
        throw new BadRequestException(e);
    }
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:19,代码来源:ExpanderUtilities.java

示例3: PredictionEvaluatorConfig

import play.inject.Injector; //导入依赖的package包/类
private PredictionEvaluatorConfig(List<MetricConfig> metricConfigs,
                                  String predictorName,
                                  String predictorNameKey,
                                  List<String> groupKeys,
                                  List<String> indexerNames,
                                  List<String> predIndexerNames,
                                  Configuration daoConfigs,
                                  Injector injector, String daoConfigKey) {
    this.metricConfigs = metricConfigs;
    this.predictorName = predictorName;
    this.predictorNameKey = predictorNameKey;
    this.groupKeys = groupKeys;
    this.indexerNames = indexerNames;
    this.predIndexerNames = predIndexerNames;
    this.injector = injector;
    this.daoConfigs = daoConfigs;
    this.daoConfigKey = daoConfigKey;
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:19,代码来源:PredictionEvaluatorConfig.java

示例4: RecommendationEvaluatorConfig

import play.inject.Injector; //导入依赖的package包/类
private RecommendationEvaluatorConfig(List<MetricConfig> metricConfigs,
                                      String recommenderName,
                                      String recommenderNameKey,
                                      List<String> indexerNames,
                                      List<String> recIndexerNames,
                                      Configuration daoConfigs,
                                      List<String> groupKeys,
                                      String daoConfigKey,
                                      Injector injector) {
    this.metricConfigs = metricConfigs;
    this.recommenderName = recommenderName;
    this.recommenderNameKey = recommenderNameKey;
    this.indexerNames = indexerNames;
    this.recIndexerNames = recIndexerNames;
    this.injector = injector;
    this.daoConfigKey = daoConfigKey;
    this.groupKeys = groupKeys;
    this.daoConfigs = daoConfigs;
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:20,代码来源:RecommendationEvaluatorConfig.java

示例5: getFeatureExtractorConfig

import play.inject.Injector; //导入依赖的package包/类
public static FeatureExtractorConfig getFeatureExtractorConfig(Configuration extractorConfig,
                                                        Injector injector) {
    Map<String, List<String>> fea2svdfeas = new HashMap<>();
    Configuration config = extractorConfig.getConfig("feature2dependents");
    for (String key : config.keys()) {
        fea2svdfeas.put(key, config.getStringList(key));
    }
    Boolean sparse = false;
    if (extractorConfig.asMap().containsKey("sparse")) {
        sparse = extractorConfig.getBoolean("sparse");
    }
    return new SVDFeatureFactorExtractorConfig(injector,
            fea2svdfeas,
            extractorConfig.getString("indexName"),
            extractorConfig.getString("predictorName"),
            extractorConfig.getString("modelName"), sparse);
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:18,代码来源:SVDFeatureFactorExtractorConfig.java

示例6: ESQueryBasedRetrieverConfig

import play.inject.Injector; //导入依赖的package包/类
private ESQueryBasedRetrieverConfig(String elasticSearchIndex,
                                    String elasticSearchScoreName,
                                    String retrieveType,
                                    List<String> retrieveFields,
                                    String elasticSearchReqKey,
                                    String setScrollKey,
                                    boolean defaultMatchAll,
                                    Injector injector, Configuration config,
                                    String queryKey, List<String> matchFields) {
    super(config);
    this.injector = injector;
    this.retrieveFields = retrieveFields;
    this.retrieveType = retrieveType;
    this.elasticSearchIndex = elasticSearchIndex;
    this.elasticSearchReqKey = elasticSearchReqKey;
    this.elasticSearchScoreName = elasticSearchScoreName;
    this.setScrollKey = setScrollKey;
    this.queryKey = queryKey;
    this.defaultMatchAll = defaultMatchAll;
    this.matchFields = matchFields;
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:22,代码来源:ESQueryBasedRetrieverConfig.java

示例7: getIndexerConfig

import play.inject.Injector; //导入依赖的package包/类
public static IndexerConfig getIndexerConfig(Configuration indexerConfig,
                                             Injector injector) {
    int numBuckets = indexerConfig.getInt("numBuckets");
    int usedBuckets = numBuckets;
    if (indexerConfig.asMap().containsKey("usedBuckets")) {
        usedBuckets = indexerConfig.getInt("usedBuckets");
    }
    return new GroupedIndexerConfig(indexerConfig, injector,
            indexerConfig.getString("dataDir"), indexerConfig.getString("dependedIndexer"),
            indexerConfig.getString("dataDirKey"), indexerConfig.getStringList("dataFields"),
            indexerConfig.getString("daoNameKey"), indexerConfig.getString("daoName"),
            indexerConfig.getString("filesKey"), indexerConfig.getString("separatorKey"),
            numBuckets, indexerConfig.getStringList("groupKeys"),
            indexerConfig.getStringList("orderFields"), indexerConfig.getBoolean("descending"),
            indexerConfig.getString("separator"),
            indexerConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get()),
            indexerConfig.getString("daoConfigKey"), usedBuckets);
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:19,代码来源:GroupedIndexerConfig.java

示例8: beforeStart

import play.inject.Injector; //导入依赖的package包/类
public void beforeStart(Application application) {
    Injector injector = application.injector();
    Configuration configuration = application.configuration();
    SamanthaConfigService configService = injector.instanceOf(SamanthaConfigService.class);
    List<String> enabledEngines = configuration.getStringList(ConfigKey.ENGINES_ENABLED.get());
    Configuration samanthaConfig = configuration.getConfig(ConfigKey.SAMANTHA_BASE.get());
    for (String engine : enabledEngines) {
        Configuration engineConfig = samanthaConfig.getConfig(engine);
        List<String> schedulerNames = engineConfig.getStringList(ConfigKey.ENGINE_BEFORE_START_SCHEDULERS.get());
        if (schedulerNames != null) {
            for (String scheduler : schedulerNames) {
                RequestContext peudoReq = new RequestContext(Json.newObject(), engine);
                configService.getSchedulerConfig(scheduler, peudoReq).runJobs();
            }
        }
    }
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:18,代码来源:ServerGlobal.java

示例9: AggregateIndexerConfig

import play.inject.Injector; //导入依赖的package包/类
private AggregateIndexerConfig(Configuration config, Injector injector, Configuration daoConfigs,
                                String daoConfigKey, List<String> otherFields,
                                String daoNameKey, String daoName, String filesKey, String filePathKey,
                                String separatorKey, String indexerName,
                                List<String> groupKeys, String filePath, String separator,
                                String aggCntName, String aggSumAppendix, List<String> aggFields) {
    this.groupKeys = groupKeys;
    this.filePathKey = filePathKey;
    this.filePath = filePath;
    this.otherFields = otherFields;
    this.daoName = daoName;
    this.daoNameKey = daoNameKey;
    this.filesKey = filesKey;
    this.separatorKey = separatorKey;
    this.separator = separator;
    this.indexerName = indexerName;
    this.config = config;
    this.daoConfigs = daoConfigs;
    this.daoConfigKey = daoConfigKey;
    this.injector = injector;
    this.aggCntName = aggCntName;
    this.aggFields = aggFields;
    this.aggSumAppendix = aggSumAppendix;
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:25,代码来源:AggregateIndexerConfig.java

示例10: RedisBasedIndexerConfig

import play.inject.Injector; //导入依赖的package包/类
private RedisBasedIndexerConfig(
                                String keyFieldsKey, String sortFieldKey, String indexPrefixKey,
                                String hashFieldsKey, Configuration daoConfigs, Injector injector,
                                String indexStructureKey, List<String> keyFields, List<String> hashFields,
                                String sortField, String indexPrefix, String indexStructure,
                                String daoConfigKey, Configuration config) {
    this.keyFieldsKey = keyFieldsKey;
    this.sortFieldKey = sortFieldKey;
    this.indexPrefixKey = indexPrefixKey;
    this.daoConfigs = daoConfigs;
    this.injector = injector;
    this.hashFieldsKey = hashFieldsKey;
    this.indexStructureKey = indexStructureKey;
    this.daoConfigKey = daoConfigKey;
    this.keyFields = keyFields;
    this.hashFields = hashFields;
    this.sortField = sortField;
    this.indexPrefix = indexPrefix;
    this.indexStructure = indexStructure;
    this.config = config;
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:22,代码来源:RedisBasedIndexerConfig.java

示例11: getPredictorConfig

import play.inject.Injector; //导入依赖的package包/类
public static PredictorConfig getPredictorConfig(Configuration predictorConfig,
                                                 Injector injector) {
    FeaturizerConfigParser parser = injector.instanceOf(
            FeatureExtractorListConfigParser.class);
    Configuration daoConfigs = predictorConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get());
    List<FeatureExtractorConfig> feaExtConfigs = parser.parse(predictorConfig
            .getConfig(ConfigKey.PREDICTOR_FEATURIZER_CONFIG.get()));
    List<Configuration> expanders = ExpanderUtilities.getEntityExpandersConfig(predictorConfig);
    int maxIter = predictorConfig.getInt("maxNumTrees");
    StandardBoostingMethod boostingMethod = new StandardBoostingMethod(maxIter);
    return new GBDTPredictorConfig(predictorConfig.getString("modelName"),
            feaExtConfigs, predictorConfig.getStringList("features"),
            predictorConfig.getString("labelName"),
            predictorConfig.getString("weightName"), daoConfigs, expanders, injector,
            injector.instanceOf(TreeLearningMethod.class),
            predictorConfig.getStringList("groupKeys"),
            predictorConfig.getString("modelFile"),
            predictorConfig.getConfig("objectiveConfig"), boostingMethod,
            predictorConfig.getString("daoConfigKey"),
            predictorConfig);
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:22,代码来源:GBDTPredictorConfig.java

示例12: RegressionTreeGBCentPredictorConfig

import play.inject.Injector; //导入依赖的package包/类
private RegressionTreeGBCentPredictorConfig(String modelName, String svdfeaModelName, String svdfeaPredictorName,
                                            List<String> treeFeatures, List<String> groupKeys,
                                            List<FeatureExtractorConfig> treeExtractorsConfig,
                                            Configuration daosConfig, List<Configuration> expandersConfig,
                                            Configuration methodConfig, Injector injector, String modelFile,
                                            String daoConfigKey, Configuration config) {
    this.daosConfig = daosConfig;
    this.expandersConfig = expandersConfig;
    this.modelName = modelName;
    this.svdfeaModelName = svdfeaModelName;
    this.svdfeaPredictorName = svdfeaPredictorName;
    this.injector = injector;
    this.methodConfig = methodConfig;
    this.groupKeys = groupKeys;
    this.treeExtractorsConfig = treeExtractorsConfig;
    this.treeFeatures = treeFeatures;
    this.modelFile = modelFile;
    this.daoConfigKey = daoConfigKey;
    this.config = config;
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:21,代码来源:RegressionTreeGBCentPredictorConfig.java

示例13: CSVFileIndexer

import play.inject.Injector; //导入依赖的package包/类
public CSVFileIndexer(SamanthaConfigService configService,
                      FileWriterService dataService,
                      Configuration config, Injector injector, Configuration daoConfigs,
                      String daoConfigKey, String timestampField, List<String> dataFields,
                      String beginTimeKey, String beginTime, String endTimeKey, String endTime,
                      String daoNameKey, String daoName, String filesKey,
                      String separatorKey, String indexType, String subDaoName, String subDaoConfigKey) {
    super(config, configService, daoConfigs, daoConfigKey, injector);
    this.dataService = dataService;
    this.indexType = indexType;
    this.timestampField = timestampField;
    this.dataFields = dataFields;
    this.beginTime = beginTime;
    this.beginTimeKey = beginTimeKey;
    this.endTime = endTime;
    this.endTimeKey = endTimeKey;
    this.daoName = daoName;
    this.daoNameKey = daoNameKey;
    this.filesKey = filesKey;
    this.separatorKey = separatorKey;
    this.subDaoConfigKey = subDaoConfigKey;
    this.subDaoName = subDaoName;
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:24,代码来源:CSVFileIndexer.java

示例14: getIndexerConfig

import play.inject.Injector; //导入依赖的package包/类
public static IndexerConfig getIndexerConfig(Configuration indexerConfig,
                                             Injector injector) {
    return new UserReturnIndexerConfig(indexerConfig, injector,
            indexerConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get()),
            indexerConfig.getString("daoConfigKey"),
            indexerConfig.getString("timestampField"),
            indexerConfig.getStringList("dataFields"),
            indexerConfig.getString("daoNameKey"),
            indexerConfig.getString("daoName"),
            indexerConfig.getString("filesKey"),
            indexerConfig.getString("filePathKey"),
            indexerConfig.getString("separatorKey"),
            indexerConfig.getString("dependedIndexer"),
            indexerConfig.getString("rewardKey"),
            indexerConfig.getStringList("groupKeys"),
            indexerConfig.getString("sessionIdKey"),
            indexerConfig.getString("filePath"),
            indexerConfig.getString("separator"),
            indexerConfig.getInt("reinforceThreshold"),
            indexerConfig.getString("usedGroupsFilePath"));
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:22,代码来源:UserReturnIndexerConfig.java

示例15: GBDTPredictorConfig

import play.inject.Injector; //导入依赖的package包/类
private GBDTPredictorConfig(String modelName, List<FeatureExtractorConfig> feaExtConfigs,
                            List<String> features, String labelName, String weightName,
                            Configuration daoConfigs, List<Configuration> expandersConfig,
                            Injector injector, TreeLearningMethod method,
                            List<String> groupKeys, String modelFile, Configuration objectiveConfig,
                            StandardBoostingMethod boostingMethod, String daoConfigKey,
                            Configuration config) {
    this.modelName = modelName;
    this.feaExtConfigs = feaExtConfigs;
    this.features = features;
    this.labelName = labelName;
    this.weightName = weightName;
    this.daoConfigs = daoConfigs;
    this.groupKeys = groupKeys;
    this.expandersConfig = expandersConfig;
    this.injector = injector;
    this.method = method;
    this.modelFile = modelFile;
    this.objectiveConfig = objectiveConfig;
    this.boostingMethod = boostingMethod;
    this.daoConfigKey = daoConfigKey;
    this.config = config;
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:24,代码来源:GBDTPredictorConfig.java


注:本文中的play.inject.Injector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。