Example #1
0
  /**
   * 最大文字数エラーかを判定する.
   *
   * @return エラーがある場合:true、エラーがない場合:false
   */
  private boolean isMaxLengthError() {

    if (!maxLengthSetting.isActive()) {

      return false;
    }

    return (maxLengthSetting.value() < value.length());
  }
Example #2
0
  /**
   * 入力情報の検証を行う.
   *
   * @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;
  }