类 ErrorCodeValidator
java.lang.Object
io.github.tcq1007.valid.errorcode.util.ErrorCodeValidator
Utility class for validating error code format and rules
-
方法概要
修饰符和类型方法说明static voidreportError(Element element, String message, Messager messager) Report a general error messagestatic booleanshouldExcludeFromValidation(Integer value, int[] excludeValues) Check if a value should be excluded from validationstatic voidvalidateErrorCodeFormat(Element element, int code, String prefix, int totalLength, String fieldName, Messager messager) Validate error code format according to specified 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 oncode- The error code value to validateprefix- The required prefixtotalLength- The required total lengthfieldName- The name of the error code fieldmessager- The messager for reporting errors
-
shouldExcludeFromValidation
Check if a value should be excluded from validation- 参数:
value- The value to checkexcludeValues- Array of values to exclude- 返回:
- true if the value should be excluded, false otherwise
-
reportError
Report a general error message- 参数:
element- The element to report the error onmessage- The error messagemessager- The messager for reporting errors
-