类 EnumFieldFinder
java.lang.Object
io.github.tcq1007.valid.errorcode.util.EnumFieldFinder
Utility class for finding fields in enum classes
-
方法概要
修饰符和类型方法说明static VariableElementfindErrorCodeField(Element enumConstant, String fieldName) Find the error code field in an enum constant by field namestatic intfindFieldIndexInConstructor(Element enumConstant, String fieldName) Find the index position of a field in the constructor parametersstatic booleanisIntegerField(VariableElement codeField) Validate that the error code field is of int type
-
方法详细资料
-
findErrorCodeField
Find the error code field in an enum constant by field name- 参数:
enumConstant- The enum constant elementfieldName- The name of the field to find- 返回:
- The variable element representing the field, or null if not found
-
isIntegerField
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
Find the index position of a field in the constructor parameters- 参数:
enumConstant- The enum constantfieldName- The field name to find- 返回:
- The index position, or -1 if not found
-