Handler.java revision 4e867904c8295537803c1c8a076e130df5674b58
1package org.owasp.html; 2 3import com.google.common.base.Throwables; 4 5/** 6 * Receives notification of problems. 7 * 8 * @author Mike Samuel <mikesamuel@gmail.com> 9 */ 10public interface Handler<T> { 11 12 void handle(T x); 13 14 /** A handler that does nothing given any input. */ 15 public static final Handler<?> DO_NOTHING = new Handler<Object>() { 16 public void handle(Object x) { 17 // Really, do nothing. 18 } 19 }; 20 21 /** 22 * A handler that re-raises an error, wrapping it in a runtime exception if 23 * necessary. 24 */ 25 public static final Handler<Throwable> PROPAGATE = new Handler<Throwable>() { 26 public void handle(Throwable th) { 27 Throwables.propagate(th); 28 } 29 }; 30} 31