added messageArgument aware method

This commit is contained in:
patrick-werner 2020-02-25 19:00:52 +01:00
parent 4cd4044a0e
commit 2a2d9575e5
1 changed files with 11 additions and 1 deletions

View File

@ -279,6 +279,8 @@ public class BaseValidator {
* Set this parameter to <code>false</code> if the validation does not pass
* @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
*/
//todo: delete this when finished i18n
protected boolean rule(List<ValidationMessage> errors, IssueType type, String path, boolean thePass, String msg) {
if (!thePass) {
addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.ERROR);
@ -286,6 +288,14 @@ public class BaseValidator {
return thePass;
}
protected boolean rule(List<ValidationMessage> errors, IssueType type, String path, boolean thePass, String theMessage, Object... theMessageArguments) {
if (!thePass) {
String message = formatMessage(theMessage, theMessageArguments);
addValidationMessage(errors, type, -1, -1, path, message, IssueSeverity.ERROR);
}
return thePass;
}
public boolean rule(List<ValidationMessage> errors, Source source, IssueType type, String path, boolean thePass, String msg) {
if (!thePass) {
addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.ERROR, source);