emptyOVO commented on code in PR #10945:
URL: https://github.com/apache/inlong/pull/10945#discussion_r1735672712


##########
inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/parser/ParserTools.java:
##########
@@ -0,0 +1,64 @@
+package org.apache.inlong.sdk.transform.process.parser;
+
+import com.google.common.collect.Maps;
+import lombok.extern.slf4j.Slf4j;
+import net.sf.jsqlparser.expression.Expression;
+import net.sf.jsqlparser.schema.Column;
+import org.reflections.Reflections;
+import org.reflections.scanners.Scanners;
+
+import java.lang.reflect.Constructor;
+import java.util.Map;
+import java.util.Set;
+
+@Slf4j
+public class ParserTools {
+    private static final String PARSER_PATH = 
"org.apache.inlong.sdk.transform.process.parser";
+    private final static Map<Class<? extends Expression>, Class<?>> parserMap 
= Maps.newConcurrentMap();
+
+    static{
+        init();
+    }
+    private static void init() {
+        Reflections reflections = new Reflections(PARSER_PATH, 
Scanners.TypesAnnotated);
+        Set<Class<?>> clazzSet = 
reflections.getTypesAnnotatedWith(TransformParser.class);
+        for (Class<?> clazz : clazzSet) {
+            if (ValueParser.class.isAssignableFrom(clazz)) {
+                TransformParser annotation = 
clazz.getAnnotation(TransformParser.class);
+                if (annotation == null) {
+                    continue;
+                }
+                Class<? extends Expression>[] values = annotation.value();
+                for (Class<? extends Expression> value : values) {
+                    if (value==null) {
+                        continue;
+                    }
+                    parserMap.compute(value, (name, former) -> {

Review Comment:
   fix



-- 
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-unsubscr...@inlong.apache.org

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

Reply via email to