This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 3312690518c Add shardingsphere-infra-expr-type module (#28561)
3312690518c is described below

commit 3312690518ce8e7de108767b202ea8b7d478c6a3
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Sep 24 13:09:59 2023 +0800

    Add shardingsphere-infra-expr-type module (#28561)
    
    * Revise javadoc on InlineExpressionParser
    
    * Add shardingsphere-infra-expr-type module
    
    * Fix javadoc
    
    * Refactor PureListInlineExpressionParser
    
    * Refactor PureListInlineExpressionParser
    
    * Remove useless javadoc
    
    * Simply refactor
---
 .../expr/core/fixture/CustomInlineExpressionParserFixture.java |  2 +-
 infra/expr/pom.xml                                             |  4 +---
 .../shardingsphere/infra/expr/spi/InlineExpressionParser.java  |  8 +++-----
 infra/expr/{ => type}/espresso/pom.xml                         |  4 ++--
 .../infra/expr/espresso/EspressoInlineExpressionParser.java    |  8 +-------
 ...apache.shardingsphere.infra.expr.spi.InlineExpressionParser |  0
 .../expr/espresso/EspressoInlineExpressionParserTest.java      |  0
 infra/expr/{ => type}/groovy/pom.xml                           |  2 +-
 .../infra/expr/groovy/GroovyInlineExpressionParser.java        |  8 +-------
 ...apache.shardingsphere.infra.expr.spi.InlineExpressionParser |  0
 .../infra/expr/groovy/GroovyInlineExpressionParserTest.java    |  0
 infra/expr/{ => type}/pom.xml                                  |  6 ++----
 infra/expr/{ => type}/purelist/pom.xml                         |  2 +-
 .../infra/expr/purelist/PureListInlineExpressionParser.java    | 10 ++--------
 ...apache.shardingsphere.infra.expr.spi.InlineExpressionParser |  0
 .../expr/purelist/PureListInlineExpressionParserTest.java      |  0
 16 files changed, 15 insertions(+), 39 deletions(-)

diff --git 
a/infra/expr/core/src/test/java/org/apache/shardingsphere/infra/expr/core/fixture/CustomInlineExpressionParserFixture.java
 
b/infra/expr/core/src/test/java/org/apache/shardingsphere/infra/expr/core/fixture/CustomInlineExpressionParserFixture.java
index 3f0f8d5a59d..02a6088740c 100644
--- 
a/infra/expr/core/src/test/java/org/apache/shardingsphere/infra/expr/core/fixture/CustomInlineExpressionParserFixture.java
+++ 
b/infra/expr/core/src/test/java/org/apache/shardingsphere/infra/expr/core/fixture/CustomInlineExpressionParserFixture.java
@@ -29,7 +29,7 @@ public final class CustomInlineExpressionParserFixture 
implements InlineExpressi
     
     @Override
     public void init(final Properties props) {
-        this.inlineExpression = props.getProperty(INLINE_EXPRESSION_KEY);
+        inlineExpression = props.getProperty(INLINE_EXPRESSION_KEY);
     }
     
     @Override
diff --git a/infra/expr/pom.xml b/infra/expr/pom.xml
index 9f9e4e7cb64..6b30073cea4 100644
--- a/infra/expr/pom.xml
+++ b/infra/expr/pom.xml
@@ -30,8 +30,6 @@
     <modules>
         <module>spi</module>
         <module>core</module>
-        <module>groovy</module>
-        <module>purelist</module>
-        <module>espresso</module>
+        <module>type</module>
     </modules>
 </project>
diff --git 
a/infra/expr/spi/src/main/java/org/apache/shardingsphere/infra/expr/spi/InlineExpressionParser.java
 
b/infra/expr/spi/src/main/java/org/apache/shardingsphere/infra/expr/spi/InlineExpressionParser.java
index 7578f5f8f2d..c19b083957e 100644
--- 
a/infra/expr/spi/src/main/java/org/apache/shardingsphere/infra/expr/spi/InlineExpressionParser.java
+++ 
b/infra/expr/spi/src/main/java/org/apache/shardingsphere/infra/expr/spi/InlineExpressionParser.java
@@ -36,10 +36,9 @@ public interface InlineExpressionParser extends TypedSPI {
     
     /**
      * This method is used to return the inlineExpression String itself. In 
some cases, you may want to do
-     * additional processing on inlineExpression to return a specific value, 
in which case you need to override this
-     * method.
+     * additional processing on inlineExpression to return a specific value, 
in which case you need to override this method.
      *
-     * @return result processed inline expression defined by the SPI 
implementation.
+     * @return result processed inline expression defined by the SPI 
implementation
      */
     String handlePlaceHolder();
     
@@ -54,8 +53,7 @@ public interface InlineExpressionParser extends TypedSPI {
      * Evaluate closure.
      *
      * @return closure
-     * @throws UnsupportedOperationException In most cases, users should not 
implement this method, and the return value
-     *                                       of this method can only be a 
Groovy Closure.
+     * @throws UnsupportedOperationException In most cases, users should not 
implement this method, and the return value of this method can only be a Groovy 
closure
      */
     default Closure<?> evaluateClosure() {
         throw new UnsupportedOperationException("This SPI implementation does 
not support the use of this method.");
diff --git a/infra/expr/espresso/pom.xml b/infra/expr/type/espresso/pom.xml
similarity index 95%
rename from infra/expr/espresso/pom.xml
rename to infra/expr/type/espresso/pom.xml
index df7c6fc1cfb..df2cf432cd1 100644
--- a/infra/expr/espresso/pom.xml
+++ b/infra/expr/type/espresso/pom.xml
@@ -20,7 +20,7 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-infra-expr</artifactId>
+        <artifactId>shardingsphere-infra-expr-type</artifactId>
         <version>5.4.1-SNAPSHOT</version>
     </parent>
     <artifactId>shardingsphere-infra-expr-espresso</artifactId>
@@ -85,7 +85,7 @@
                                 </artifactItem>
                             </artifactItems>
                             <stripVersion>true</stripVersion>
-                            
<outputDirectory>${project.build.outputDirectory}/espresso-need-libs</outputDirectory>
+                            
<outputDirectory>target/classes/espresso-need-libs</outputDirectory>
                         </configuration>
                     </execution>
                 </executions>
diff --git 
a/infra/expr/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
 
b/infra/expr/type/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
similarity index 96%
rename from 
infra/expr/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
rename to 
infra/expr/type/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
index 8e9b33fc3ad..0e1839b4f36 100644
--- 
a/infra/expr/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
+++ 
b/infra/expr/type/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
@@ -52,15 +52,9 @@ public final class EspressoInlineExpressionParser implements 
InlineExpressionPar
         JAVA_CLASSPATH = dir + File.separator + "groovy.jar";
     }
     
-    /**
-     * Initialize SPI.
-     *
-     * @param props A Properties instance that carries inlineExpression.
-     *              And for compatibility reasons, inlineExpression allows to 
be null.
-     */
     @Override
     public void init(final Properties props) {
-        this.inlineExpression = props.getProperty(INLINE_EXPRESSION_KEY);
+        inlineExpression = props.getProperty(INLINE_EXPRESSION_KEY);
     }
     
     @Override
diff --git 
a/infra/expr/espresso/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
 
b/infra/expr/type/espresso/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
similarity index 100%
rename from 
infra/expr/espresso/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
rename to 
infra/expr/type/espresso/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
diff --git 
a/infra/expr/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
 
b/infra/expr/type/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
similarity index 100%
rename from 
infra/expr/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
rename to 
infra/expr/type/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
diff --git a/infra/expr/groovy/pom.xml b/infra/expr/type/groovy/pom.xml
similarity index 96%
rename from infra/expr/groovy/pom.xml
rename to infra/expr/type/groovy/pom.xml
index cbc18ed0bed..4591658174e 100644
--- a/infra/expr/groovy/pom.xml
+++ b/infra/expr/type/groovy/pom.xml
@@ -20,7 +20,7 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-infra-expr</artifactId>
+        <artifactId>shardingsphere-infra-expr-type</artifactId>
         <version>5.4.1-SNAPSHOT</version>
     </parent>
     <artifactId>shardingsphere-infra-expr-groovy</artifactId>
diff --git 
a/infra/expr/groovy/src/main/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParser.java
 
b/infra/expr/type/groovy/src/main/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParser.java
similarity index 96%
rename from 
infra/expr/groovy/src/main/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParser.java
rename to 
infra/expr/type/groovy/src/main/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParser.java
index 27411402be0..92eb078a3c4 100644
--- 
a/infra/expr/groovy/src/main/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParser.java
+++ 
b/infra/expr/type/groovy/src/main/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParser.java
@@ -51,15 +51,9 @@ public final class GroovyInlineExpressionParser implements 
InlineExpressionParse
     
     private String inlineExpression;
     
-    /**
-     * Initialize SPI.
-     *
-     * @param props A Properties instance that carries inlineExpression.
-     *              And for compatibility reasons, inlineExpression allows to 
be null.
-     */
     @Override
     public void init(final Properties props) {
-        this.inlineExpression = props.getProperty(INLINE_EXPRESSION_KEY);
+        inlineExpression = props.getProperty(INLINE_EXPRESSION_KEY);
     }
     
     @Override
diff --git 
a/infra/expr/groovy/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
 
b/infra/expr/type/groovy/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
similarity index 100%
rename from 
infra/expr/groovy/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
rename to 
infra/expr/type/groovy/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
diff --git 
a/infra/expr/groovy/src/test/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParserTest.java
 
b/infra/expr/type/groovy/src/test/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParserTest.java
similarity index 100%
rename from 
infra/expr/groovy/src/test/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParserTest.java
rename to 
infra/expr/type/groovy/src/test/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParserTest.java
diff --git a/infra/expr/pom.xml b/infra/expr/type/pom.xml
similarity index 89%
copy from infra/expr/pom.xml
copy to infra/expr/type/pom.xml
index 9f9e4e7cb64..12131f0ae98 100644
--- a/infra/expr/pom.xml
+++ b/infra/expr/type/pom.xml
@@ -20,16 +20,14 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-infra</artifactId>
+        <artifactId>shardingsphere-infra-expr</artifactId>
         <version>5.4.1-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-infra-expr</artifactId>
+    <artifactId>shardingsphere-infra-expr-type</artifactId>
     <packaging>pom</packaging>
     <name>${project.artifactId}</name>
     
     <modules>
-        <module>spi</module>
-        <module>core</module>
         <module>groovy</module>
         <module>purelist</module>
         <module>espresso</module>
diff --git a/infra/expr/purelist/pom.xml b/infra/expr/type/purelist/pom.xml
similarity index 96%
rename from infra/expr/purelist/pom.xml
rename to infra/expr/type/purelist/pom.xml
index 0e3d95b390b..0ac0438b150 100644
--- a/infra/expr/purelist/pom.xml
+++ b/infra/expr/type/purelist/pom.xml
@@ -20,7 +20,7 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-infra-expr</artifactId>
+        <artifactId>shardingsphere-infra-expr-type</artifactId>
         <version>5.4.1-SNAPSHOT</version>
     </parent>
     <artifactId>shardingsphere-infra-expr-purelist</artifactId>
diff --git 
a/infra/expr/purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java
 
b/infra/expr/type/purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java
similarity index 88%
rename from 
infra/expr/purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java
rename to 
infra/expr/type/purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java
index ab1d3a34af2..f84e5a7fee1 100644
--- 
a/infra/expr/purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java
+++ 
b/infra/expr/type/purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java
@@ -34,15 +34,9 @@ public final class PureListInlineExpressionParser implements 
InlineExpressionPar
     
     private String inlineExpression;
     
-    /**
-     * Initialize SPI.
-     *
-     * @param props A Properties instance that carries inlineExpression.
-     *              And for compatibility reasons, inlineExpression allows to 
be null.
-     */
     @Override
     public void init(final Properties props) {
-        this.inlineExpression = props.getProperty(INLINE_EXPRESSION_KEY);
+        inlineExpression = props.getProperty(INLINE_EXPRESSION_KEY);
     }
     
     @Override
@@ -60,7 +54,7 @@ public final class PureListInlineExpressionParser implements 
InlineExpressionPar
         StringBuilder segment = new StringBuilder();
         for (int i = 0; i < inlineExpression.length(); i++) {
             char each = inlineExpression.charAt(i);
-            if (each == SPLITTER) {
+            if (SPLITTER == each) {
                 result.add(segment.toString().trim());
                 segment.setLength(0);
             } else {
diff --git 
a/infra/expr/purelist/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
 
b/infra/expr/type/purelist/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
similarity index 100%
rename from 
infra/expr/purelist/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
rename to 
infra/expr/type/purelist/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser
diff --git 
a/infra/expr/purelist/src/test/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParserTest.java
 
b/infra/expr/type/purelist/src/test/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParserTest.java
similarity index 100%
rename from 
infra/expr/purelist/src/test/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParserTest.java
rename to 
infra/expr/type/purelist/src/test/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParserTest.java

Reply via email to