@Override public void applyTo(Binder binder) { getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).to(getLinkedKey())); }
@Override protected void configure() { bind(TransportExtendedAnalyzeAction.class).asEagerSingleton(); MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class); transportActionsBinder.addBinding(ExtendedAnalyzeAction.INSTANCE).to(TransportExtendedAnalyzeAction.class).asEagerSingleton(); MapBinder<String, GenericAction> actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class); actionsBinder.addBinding(ExtendedAnalyzeAction.NAME).toInstance(ExtendedAnalyzeAction.INSTANCE); } }
@Override protected void configure() { bind(TransportRestoreAction.class).asEagerSingleton(); bind(RestoreParser.class).asEagerSingleton(); MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class); transportActionsBinder.addBinding(RestoreAction.INSTANCE).to(TransportRestoreAction.class).asEagerSingleton(); MapBinder<String, GenericAction> actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class); actionsBinder.addBinding(RestoreAction.NAME).toInstance(RestoreAction.INSTANCE); }
@Override protected void configure() { bind(ActionFilters.class).toInstance(actionFilters); bind(DestructiveOperations.class).toInstance(destructiveOperations); if (false == transportClient) { // Supporting classes only used when not a transport client bind(AutoCreateIndex.class).toInstance(autoCreateIndex); bind(TransportLivenessAction.class).asEagerSingleton(); // register GenericAction -> transportAction Map used by NodeClient @SuppressWarnings("rawtypes") MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class); for (ActionHandler<?, ?> action : actions.values()) { // bind the action as eager singleton, so the map binder one will reuse it bind(action.getTransportAction()).asEagerSingleton(); transportActionsBinder.addBinding(action.getAction()).to(action.getTransportAction()).asEagerSingleton(); for (Class<?> supportAction : action.getSupportTransportActions()) { bind(supportAction).asEagerSingleton(); } } } }
@Override protected void configure() { bind(TransportDumpAction.class).asEagerSingleton(); bind(DumpParser.class).asEagerSingleton(); MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class); transportActionsBinder.addBinding(DumpAction.INSTANCE).to(TransportDumpAction.class).asEagerSingleton(); MapBinder<String, GenericAction> actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class); actionsBinder.addBinding(DumpAction.NAME).toInstance(DumpAction.INSTANCE); } }
@Override protected final void bindExtensions(Binder binder) { MapBinder<String, T> parserMapBinder = MapBinder.newMapBinder(binder, String.class, extensionClass); for (Map.Entry<String, Class<? extends T>> clazz : extensions.entrySet()) { parserMapBinder.addBinding(clazz.getKey()).to(clazz.getValue()); } } }
@Override protected void configure() { bind(TransportReindexAction.class).asEagerSingleton(); bind(ReindexParser.class).asEagerSingleton(); MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder( binder(), GenericAction.class, TransportAction.class); transportActionsBinder.addBinding(ReindexAction.INSTANCE).to( TransportReindexAction.class).asEagerSingleton(); MapBinder<String, GenericAction> actionsBinder = MapBinder .newMapBinder(binder(), String.class, GenericAction.class); actionsBinder.addBinding(ReindexAction.NAME).toInstance( ReindexAction.INSTANCE); }
protected void configureFetchSubPhase() { Multibinder<FetchSubPhase> fetchSubPhaseMultibinder = Multibinder.newSetBinder(binder(), FetchSubPhase.class); fetchSubPhaseMultibinder.addBinding().to(ExplainFetchSubPhase.class); fetchSubPhaseMultibinder.addBinding().to(FieldDataFieldsFetchSubPhase.class); fetchSubPhaseMultibinder.addBinding().to(ScriptFieldsFetchSubPhase.class); fetchSubPhaseMultibinder.addBinding().to(FetchSourceSubPhase.class); fetchSubPhaseMultibinder.addBinding().to(VersionFetchSubPhase.class); fetchSubPhaseMultibinder.addBinding().to(MatchedQueriesFetchSubPhase.class); fetchSubPhaseMultibinder.addBinding().to(HighlightPhase.class); for (Class<? extends FetchSubPhase> clazz : fetchSubPhases) { fetchSubPhaseMultibinder.addBinding().to(clazz); } bind(InnerHitsFetchSubPhase.class).asEagerSingleton(); }
@Override protected void configure() { bind(TransportExportAction.class).asEagerSingleton(); bind(ExportParser.class).asEagerSingleton(); bind(Exporter.class).asEagerSingleton(); MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class); transportActionsBinder.addBinding(ExportAction.INSTANCE).to(TransportExportAction.class).asEagerSingleton(); MapBinder<String, GenericAction> actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class); actionsBinder.addBinding(ExportAction.NAME).toInstance(ExportAction.INSTANCE); } }
@Override protected void configure() { Multibinder<ViewEngineService> multibinder = Multibinder.newSetBinder(binder(), ViewEngineService.class); multibinder.addBinding().to(MvelViewEngineService.class); multibinder.addBinding().to(BinaryViewEngineService.class); for (Class<? extends ViewEngineService> viewEngine : viewEngines) { multibinder.addBinding().to(viewEngine); } bind(ViewService.class).asEagerSingleton(); } }
@Override protected void configure() { bind(TransportImportAction.class).asEagerSingleton(); bind(ImportParser.class).asEagerSingleton(); bind(Importer.class).asEagerSingleton(); MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class); transportActionsBinder.addBinding(ImportAction.INSTANCE).to(TransportImportAction.class).asEagerSingleton(); MapBinder<String, GenericAction> actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class); actionsBinder.addBinding(ImportAction.NAME).toInstance(ImportAction.INSTANCE); }
@Override protected void configure() { Multibinder<ViewEngineService> multibinder = Multibinder.newSetBinder(binder(), ViewEngineService.class); multibinder.addBinding().to(MvelViewEngineService.class); multibinder.addBinding().to(BinaryViewEngineService.class); for (Class<? extends ViewEngineService> viewEngine : viewEngines) { multibinder.addBinding().to(viewEngine); } bind(ViewService.class).asEagerSingleton(); } }
@Override protected final void bindExtensions(Binder binder) { Multibinder<T> allocationMultibinder = Multibinder.newSetBinder(binder, extensionClass); for (Class<? extends T> clazz : extensions) { binder.bind(clazz).asEagerSingleton(); allocationMultibinder.addBinding().to(clazz); } } }
protected void configureFunctionScore() { Multibinder<ScoreFunctionParser> parserMapBinder = Multibinder.newSetBinder(binder(), ScoreFunctionParser.class); for (Class<? extends ScoreFunctionParser> clazz : functionScoreParsers) { parserMapBinder.addBinding().to(clazz); } bind(ScoreFunctionParserMapper.class); }
@Override protected void configure() { final Multibinder<EngineFilter> engineFilterMultibinder = Multibinder .newSetBinder(binder(), EngineFilter.class); for (final Class<? extends EngineFilter> engineFilter : engineFilters) { engineFilterMultibinder.addBinding().to(engineFilter); } bind(EngineFilters.class).asEagerSingleton(); }
@Override protected void configure() { bind(IndexDeletionPolicy.class) .annotatedWith(Names.named("actual")) .to(KeepOnlyLastDeletionPolicy.class) .asEagerSingleton(); bind(SnapshotDeletionPolicy.class) .asEagerSingleton(); } }
@Override public void applyTo(Binder binder) { getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).to(getLinkedKey())); }
@Override public void applyTo(Binder binder) { getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).to(getLinkedKey())); }
@Override public void applyTo(Binder binder) { getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).to(getLinkedKey())); }
@Override public void applyTo(Binder binder) { getScoping().applyTo(binder.withSource(getSource()).bind(getKey()).to(getLinkedKey())); }