liunaijie commented on code in PR #8634:
URL: https://github.com/apache/seatunnel/pull/8634#discussion_r1952108337


##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/options/EnvOptionRule.java:
##########
@@ -15,26 +15,38 @@
  * limitations under the License.
  */
 
-package org.apache.seatunnel.api.env;
+package org.apache.seatunnel.api.options;
 
-import org.apache.seatunnel.api.common.CommonOptions;
 import org.apache.seatunnel.api.configuration.util.OptionRule;
+import org.apache.seatunnel.api.table.factory.Factory;
 
-public class EnvOptionRule {
+import com.google.auto.service.AutoService;
 
-    public static OptionRule getEnvOptionRules() {
+@AutoService(Factory.class)
+public class EnvOptionRule implements Factory {

Review Comment:
   If use `Factory`. we can use 
   ```
   OptionRule optionRule = ServiceLoader.load(Factory.class, 
classLoader).filter("xxxxx").getEnvOptionRules();
   
   
   ConfigValidator.of(context.getOptions()).validate(optionRule);
   ```` 
   to 
   
   
   If not implement Factory. the behavior is 
   ```
   
   OptionRule optionRule; 
   if( is connector ){
     optionRule = ServiceLoader.load(Factory.class, 
classLoader).filter("xxxxx").getEnvOptionRules();
   } else if ( is env ) {
     optionRule = EnvOptionRule.getEnvOptionRules();
   } 
   
   ConfigValidator.of(context.getOptions()).validate(optionRule);
   
   ```
   
   I am both Ok. but looks implement `Factory` looks have a unified style.
   
   
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to