/** * 許可文字列エラーがあるかを判定する. * * @return エラーがある場合:true、エラーがない場合:false */ private boolean isValidCharcterError() { if (!validCharSetting.isActive()) { return false; } if (value.isEmpty()) { return false; } final Optional<ValidCharcterType> matchedPattern = Arrays.stream(validCharSetting.value()).filter(v -> !v.isMatch(value)).findFirst(); return matchedPattern.isPresent(); }
/** * 入力情報の検証を行う. * * @return 検証結果 */ @Override public ValidateErrors validate() { final ValidateErrors errors = new ValidateErrors(); if (isRequiredError()) { errors.add(new ValidateError(ErrorInfo.Required, requiredSetting.label())); } if (isMaxLengthError()) { final Object[] messageParam = {maxLengthSetting.label(), maxLengthSetting.value()}; errors.add(new ValidateError(ErrorInfo.MaxLengthOver, messageParam)); } if (isValidCharcterError()) { errors.add(new ValidateError(ErrorInfo.InvalidCharacters, validCharSetting.label())); } return errors; }