类 EnumFieldFinder

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

public class EnumFieldFinder extends Object
Utility class for finding fields in enum classes
  • 方法详细资料

    • findErrorCodeField

      public static VariableElement findErrorCodeField(Element enumConstant, String fieldName)
      Find the error code field in an enum constant by field name
      参数:
      enumConstant - The enum constant element
      fieldName - The name of the field to find
      返回:
      The variable element representing the field, or null if not found
    • isIntegerField

      public static boolean isIntegerField(VariableElement codeField)
      Validate that the error code field is of int type
      参数:
      codeField - The field to validate
      返回:
      true if the field is of int type, false otherwise
    • findFieldIndexInConstructor

      public static int findFieldIndexInConstructor(Element enumConstant, String fieldName)
      Find the index position of a field in the constructor parameters
      参数:
      enumConstant - The enum constant
      fieldName - The field name to find
      返回:
      The index position, or -1 if not found