接口参数传递class

    public static List<String> getExcelProperty(Class<?> clazz,Integer index) {
        List<String> headers = new ArrayList<>();
        Field[] fields = clazz.getDeclaredFields();
        for (Field field : fields) {
            if (field.isAnnotationPresent(ExcelProperty.class)) {
                ExcelProperty excelProperty = field.getAnnotation(ExcelProperty.class);
                headers.add(excelProperty.value()[index]);
            }
        }
        return headers;
    }

  

posted @ 2025-10-13 15:33  八英里  阅读(4)  评论(0)    收藏  举报