You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "featzhang (via GitHub)" <gi...@apache.org> on 2023/04/10 15:04:47 UTC

[GitHub] [inlong] featzhang commented on a diff in pull request #7819: [INLONG-7816][Manager] Support validation rules when exporting Excel file

featzhang commented on code in PR #7819:
URL: https://github.com/apache/inlong/pull/7819#discussion_r1161800287


##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/tool/excel/ExcelTool.java:
##########
@@ -159,6 +168,54 @@ private static void fillSheetHeader(XSSFRow row, List<String> heads) {
             cell.setCellValue(new XSSFRichTextString(heads.get(index)));
         });
     }
+    /**
+     * Fills the validation constraints for a given sheet based on the provided class and fields.
+     *
+     * @param clazz  the class to use for validation constraints
+     * @param sheet  the sheet to fill with validation constraints
+     * @param fields the fields to use for validation constraints
+     */
+    private static <T> void fillSheetValidation(Class<T> clazz, XSSFSheet sheet, Field[] fields) {
+        List<Pair<String, ExcelField>> excelFields = Arrays.stream(fields).map(field -> {
+            field.setAccessible(true);
+            return Pair.of(field.getName(), field.getAnnotation(ExcelField.class));
+        }).filter(p -> p.getRight() != null).collect(Collectors.toList());
+
+        IntStream.range(0, excelFields.size())

Review Comment:
   Fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org