コード例 #1
0
 @Override
 protected final void bindExtensions(Binder binder) {
   Multibinder<T> allocationMultibinder = Multibinder.newSetBinder(binder, extensionClass);
   for (Class<? extends T> clazz : extensions) {
     allocationMultibinder.addBinding().to(clazz);
   }
 }
コード例 #2
0
  @Override
  protected void configure() {
    bind(IndicesQueriesRegistry.class).asEagerSingleton();

    Multibinder<QueryParser> qpBinders = Multibinder.newSetBinder(binder(), QueryParser.class);
    for (Class<QueryParser> queryParser : queryParsersClasses) {
      qpBinders.addBinding().to(queryParser).asEagerSingleton();
    }
    for (QueryParser queryParser : queryParsers) {
      qpBinders.addBinding().toInstance(queryParser);
    }
    qpBinders.addBinding().to(MatchQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(MultiMatchQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(NestedQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(HasChildQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(HasParentQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(TopChildrenQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(DisMaxQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(IdsQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(MatchAllQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(QueryStringQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(BoostingQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(BoolQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(TermQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(TermsQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(FuzzyQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(RegexpQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(FieldQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(RangeQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(PrefixQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(WildcardQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(FilteredQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(ConstantScoreQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(CustomBoostFactorQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(CustomScoreQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(CustomFiltersScoreQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(SpanTermQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(SpanNotQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(SpanFirstQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(SpanNearQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(SpanOrQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(MoreLikeThisQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(MoreLikeThisFieldQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(FuzzyLikeThisQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(FuzzyLikeThisFieldQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(WrapperQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(IndicesQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(CommonTermsQueryParser.class).asEagerSingleton();
    qpBinders.addBinding().to(SpanMultiTermQueryParser.class).asEagerSingleton();

    if (ShapesAvailability.JTS_AVAILABLE) {
      qpBinders.addBinding().to(GeoShapeQueryParser.class).asEagerSingleton();
    }

    Multibinder<FilterParser> fpBinders = Multibinder.newSetBinder(binder(), FilterParser.class);
    for (Class<FilterParser> filterParser : filterParsersClasses) {
      fpBinders.addBinding().to(filterParser).asEagerSingleton();
    }
    for (FilterParser filterParser : filterParsers) {
      fpBinders.addBinding().toInstance(filterParser);
    }
    fpBinders.addBinding().to(HasChildFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(HasParentFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(NestedFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(TypeFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(IdsFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(LimitFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(TermFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(TermsFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(RangeFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(NumericRangeFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(PrefixFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(RegexpFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(ScriptFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(GeoDistanceFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(GeoDistanceRangeFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(GeoBoundingBoxFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(GeoPolygonFilterParser.class).asEagerSingleton();
    if (ShapesAvailability.JTS_AVAILABLE) {
      fpBinders.addBinding().to(GeoShapeFilterParser.class).asEagerSingleton();
    }
    fpBinders.addBinding().to(QueryFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(FQueryFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(BoolFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(AndFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(OrFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(NotFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(MatchAllFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(ExistsFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(MissingFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(IndicesFilterParser.class).asEagerSingleton();
    fpBinders.addBinding().to(WrapperFilterParser.class).asEagerSingleton();
  }