gsrs.indexer.DefaultIndexValueMakerRegistry Maven / Gradle / Ivy
The newest version!
package gsrs.indexer;
import ix.core.search.text.IndexValueMaker;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
@Service
public class DefaultIndexValueMakerRegistry {
private List indexers = new ArrayList<>();
public synchronized void addIndexer(IndexValueMaker indexValueMaker){
Objects.requireNonNull(indexValueMaker);
indexers.add(indexValueMaker);
}
public synchronized void consumeIndexers(Consumer consumer){
if(consumer!=null) {
indexers.forEach(i -> consumer.accept(i));
}
}
}