yakworks.api.problem.spi.StackTraceProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-messages Show documentation
Show all versions of api-messages Show documentation
Models and SPI for message service, api results and problems.
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);
}