All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codelibs.elasticsearch.sstmpl.module.SearchTemplateModule Maven / Gradle / Ivy

There is a newer version: 7.16.0
Show newest version
package org.codelibs.elasticsearch.sstmpl.module;

import java.util.ArrayList;
import java.util.List;

import org.codelibs.elasticsearch.sstmpl.filter.SearchTemplateFilter;
import org.codelibs.elasticsearch.sstmpl.filter.SearchTemplateFilters;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.multibindings.Multibinder;

public class SearchTemplateModule extends AbstractModule {
    private final List> searchTemplateFilters = new ArrayList<>();

    @Override
    protected void configure() {
        final Multibinder searchTemplateFilterMultibinder = Multibinder
                .newSetBinder(binder(), SearchTemplateFilter.class);
        for (final Class searchTemplateFilter : searchTemplateFilters) {
            searchTemplateFilterMultibinder.addBinding().to(
                    searchTemplateFilter);
        }
        bind(SearchTemplateFilters.class).asEagerSingleton();
    }

    public SearchTemplateModule registerSearchTemplateFillter(
            final Class searchTemplateFilter) {
        searchTemplateFilters.add(searchTemplateFilter);
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy