code: public static <X extends Exception> void validate(boolean condition, ExceptionFactory<X> factory) throws X {
      if (!condition) {
        throw factory.newInstance(null);
      }
    }
docs: Validate the boolean expression that is supposed to be true.
  If not, a recoverable exception will be thrown that the client
  is supposed to catch and recover from.
  
  @param <X> type of exception to throw if validation fails
  @param condition the condition to validate. Supposed to be true.
  @param factory the factory of recoverable exception to be thrown if validation fails.
  @throws X the recoverable exception, if validation fails