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

yakworks.api.problem.spi.StackTraceProcessor Maven / Gradle / Ivy

There is a newer version: 3.14
Show newest version
package yakworks.api.problem.spi;

import java.util.Collection;

import static java.util.ServiceLoader.load;
import static java.util.stream.StreamSupport.stream;

/**
 * @see java.util.ServiceLoader
 */
public interface StackTraceProcessor {

    // default StackTraceProcessor implementation that just returns all of them
    StackTraceProcessor DEFAULT = elements -> elements;

    //stream wizadry to combine all the services it finds, calling DEFAULT first and then passing up the chain
    StackTraceProcessor COMPOUND = stream(load(StackTraceProcessor.class).spliterator(), false)
        .reduce(DEFAULT, (first, second) -> elements -> second.process(first.process(elements)));

    Collection process(final Collection elements);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy