Skip to content

Instantly share code, notes, and snippets.

@CuriousVini
Last active December 18, 2019 21:27
Show Gist options
  • Select an option

  • Save CuriousVini/3a9da8fd75545a7d616ab836df45acfd to your computer and use it in GitHub Desktop.

Select an option

Save CuriousVini/3a9da8fd75545a7d616ab836df45acfd to your computer and use it in GitHub Desktop.
public interface FailureCollector {
/**
* Add a validation failure to this failure collector. The method returns the validation failure that was added to
* the failure collector. This failure can be used to add additional {@link ValidationFailure.Cause}s.
* For example,
* <code>failureCollector.addFailure("message", "action").withConfigProperty("configProperty");</code>
*
* @param message failure message
* @param correctiveAction corrective action
* @return a validation failure
* @throws UnsupportedOperationException if the implementation does not override this method
*/
default ValidationFailure addFailure(String message, @Nullable String correctiveAction) {
throw new UnsupportedOperationException("Adding a failure is not supported.");
}
/**
* Get list of validation failures.
*
* @return list of validation failures
*/
default List<ValidationFailure> getValidationFailures() {
throw new UnsupportedOperationException("Getting failures is not supported.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment