类 ErrorCodeRegistry
java.lang.Object
io.github.tcq1007.valid.errorcode.util.ErrorCodeRegistry
Registry for tracking and validating uniqueness of error codes across the codebase.
This class maintains a registry of all error codes encountered during compilation and provides functionality to check for duplicates. It helps ensure that error codes remain unique across different enum classes in the project.
The registry is cleared between processing rounds to ensure clean validation state for each compilation.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static voidclear()Clear the registry.static ElementgetErrorCodeDefinition(String code) Get the element where an error code was first defined.static booleanisUniqueErrorCode(String code, Element element) Checks if an error code is unique across all processed enums.
-
构造器详细资料
-
ErrorCodeRegistry
public ErrorCodeRegistry()
-
-
方法详细资料
-
isUniqueErrorCode
Checks if an error code is unique across all processed enums.- 参数:
code- The error code to checkelement- The element where the error code is defined- 返回:
- true if the error code is unique, false otherwise
-
getErrorCodeDefinition
Get the element where an error code was first defined.- 参数:
code- The error code to look up- 返回:
- The element where the error code was defined, or null if not found
-
clear
public static void clear()Clear the registry. Useful between processing rounds.
-