类 ErrorCodeValidator

java.lang.Object
io.github.tcq1007.valid.errorcode.util.ErrorCodeValidator

public class ErrorCodeValidator extends Object
Utility class for validating error code format and rules
  • 方法详细资料

    • validateErrorCodeFormat

      public static void validateErrorCodeFormat(Element element, int code, String prefix, int totalLength, String fieldName, Messager messager)
      Validate error code format according to specified rules
      参数:
      element - The element to report errors on
      code - The error code value to validate
      prefix - The required prefix
      totalLength - The required total length
      fieldName - The name of the error code field
      messager - The messager for reporting errors
    • shouldExcludeFromValidation

      public static boolean shouldExcludeFromValidation(Integer value, int[] excludeValues)
      Check if a value should be excluded from validation
      参数:
      value - The value to check
      excludeValues - Array of values to exclude
      返回:
      true if the value should be excluded, false otherwise
    • reportError

      public static void reportError(Element element, String message, Messager messager)
      Report a general error message
      参数:
      element - The element to report the error on
      message - The error message
      messager - The messager for reporting errors