Commit db6c0903 authored by Jonathan Mace's avatar Jonathan Mace

Add 'isValid' method

parent 26e85615
......@@ -10,6 +10,12 @@ import java.nio.ByteBuffer;
*/
public interface BaggageProvider<B extends BaggageContext> {
/**
* @param baggage a BaggageContext to test
* @return true if <code>baggage</code> is an instance of {@link B} or if baggage is null.
*/
boolean isValid(BaggageContext baggage);
/**
* @return a new instance of {@link B}, which may be null to indicate an empty baggage
*/
......
......@@ -9,6 +9,11 @@ import brown.tracingplane.BaggageProvider;
*/
public class NoOpBaggageContextProvider implements BaggageProvider<BaggageContext> {
@Override
public boolean isValid(BaggageContext baggage) {
return baggage == null;
}
@Override
public BaggageContext newInstance() {
return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment