P
Size: a a a
P
P
P
it
P
it
P
it
it
P
InvalidInputException exception = new InvalidInputException()
if (a) exception.addError(error1)
if (b) exception.addError(error2) //добавит
if (c) exception.addError(field, error3)
if (c) exception.addError(field, error4) //перезапишет
throwExceptionIfExist(exception)
static Object throwExceptionIfExist(InvalidInputException exception) {
if (exception.getGenericErrors() || exception.getErrors()) throw exception
else return true
}
it
it
it
exception.addError(error1)
exception.addError(error2)
Z
PT
P
it
Z