类 ErrorCodeRegistry

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

public class ErrorCodeRegistry extends Object
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.

  • 构造器详细资料

    • ErrorCodeRegistry

      public ErrorCodeRegistry()
  • 方法详细资料

    • isUniqueErrorCode

      public static boolean isUniqueErrorCode(String code, Element element)
      Checks if an error code is unique across all processed enums.
      参数:
      code - The error code to check
      element - The element where the error code is defined
      返回:
      true if the error code is unique, false otherwise
    • getErrorCodeDefinition

      public static Element getErrorCodeDefinition(String code)
      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.