src/main/java/org/valid4j/Validation.java
public static <T, X extends Exception> T validate(T o, Matcher<?> matcher, ExceptionFactory<X> factory) throws X {
    if (!matcher.matches(o)) {
      throw factory.newInstance(describingMismatchOf(o, matcher).toString());
    }
    return o;
  }
public static <T, X extends Exception> T validate(T o, Matcher<?> matcher, ExceptionFactory<X> factory) throws X {
    if (!matcher.matches(o)) {
      throw factory.newInstance(describingMismatchOf(o, matcher).toString());
    }
    return o;
  }
Validate the given object that is supposed to satisfy the matcher.
If not, a recoverable exception will be thrown that the client
is supposed to catch and recover from.

@param <T> type of object to validate
@param <X> type of exception to throw if validation fails
@param o the object to validate
@param matcher the matcher that the object must satisfy
@param factory the factory of recoverable exception to be thrown if validation fails.
@return the validated object, if valid
@throws X the recoverable exception, if validation fails