class Validator implements Wrapper {

	@Override public Handler wrap(final Handler handler) {
		return request -> {

			final Collection<String> issues=rules.stream()
					.flatMap(rule -> rule.apply(request).stream())
					.collect(toList());

			return issues.isEmpty() ? handler.handle(request) : request.reply(new Failure()

					.status(Response.UnprocessableEntity)
					.error(Failure.DataInvalid)
					.trace(trace(issues.stream()
							.map(issue -> trace(issue))
							.collect(toList())
					))

			);

		};
	}

	@SafeVarargs public  Validator(final Function<Request, Collection<String>>... rules);
	public  Validator(final Collection<Function<Request, Collection<String>>> rules);

}