فهرست منبع

new: StringUtils#compileWildcard

Ranides Atterwim 10 سال پیش
والد
کامیت
ccc4b67d70
2فایلهای تغییر یافته به همراه219 افزوده شده و 215 حذف شده
  1. 215 215
      assira1/pom.xml
  2. 4 0
      assira1/src/main/java/net/ranides/assira/text/StringUtils.java

+ 215 - 215
assira1/pom.xml

@@ -1,215 +1,215 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" 
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <groupId>net.ranides</groupId>
-    <artifactId>assira</artifactId>
-    <version>0.80.0</version>
-    <packaging>jar</packaging>
-
-    <name>assira1</name>
-    <url>http://ranides.net/projects/assira</url>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <netbeans.hint.license>WTFPL</netbeans.hint.license>
-        <project.test.memory>512m</project.test.memory>
-        <project.argLine></project.argLine>
-    </properties>
-    
-    <distributionManagement>
-        <repository>
-            <id>maven.ranides.net</id>
-            <name>maven.ranides.net</name>
-            <url>ftp://maven.ranides.net/</url>
-        </repository>
-    </distributionManagement>
-    
-    <build>
-        <extensions>
-            <extension>
-                <groupId>org.apache.maven.wagon</groupId>
-                <artifactId>wagon-ftp</artifactId>
-                <version>1.0</version>
-            </extension>
-        </extensions>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <source>1.7</source>
-                    <target>1.7</target>
-                    <compilerArgument>-Xlint:unchecked</compilerArgument>
-                    <compilerArgument>-proc:none</compilerArgument>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-pmd-plugin</artifactId>
-                <version>3.5</version>
-                <configuration>
-                    <rulesets>
-                        <ruleset>http://ranides.net/projects/pmd/3/assira.custom.xml</ruleset>
-                        <ruleset>http://ranides.net/projects/pmd/3/assira.standard.xml</ruleset>
-                        <!--
-                        <ruleset>http://dev.ranides.vnet/java/assira.custom.xml</ruleset>
-                        <ruleset>http://dev.ranides.vnet/java/assira.standard.xml</ruleset>
-                        -->
-                    </rulesets>
-                </configuration>
-            </plugin>
-            <!--
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>cobertura-maven-plugin</artifactId>
-                <version>2.5.2</version>
-            </plugin>
-            -->
-            <plugin>
-                <groupId>org.jacoco</groupId>
-                <artifactId>jacoco-maven-plugin</artifactId>
-                <version>0.7.5.201505241946</version>
-                <configuration>
-                    <propertyName>project.argLine</propertyName>
-                </configuration>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>prepare-agent</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>report</id>
-                        <phase>prepare-package</phase>
-                        <goals>
-                            <goal>report</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <version>2.9</version>
-                <executions>
-                    <execution>
-                        <id>javadocs-site</id>
-                        <phase>site</phase>
-                        <goals>
-                            <goal>javadoc</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <links>
-                        <link>http://download.oracle.com/javase/1.6.0/docs/api/</link>
-                    </links>
-                    <version>true</version>
-                    <show>public</show>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-source-plugin</artifactId>
-                <version>2.2.1</version>
-                <executions>
-                    <execution>
-                        <id>attach-sources</id>
-                        <goals>
-                            <goal>jar-no-fork</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <version>2.18.1</version>
-                <configuration>
-                    <argLine>@{project.argLine} -Xmx${project.test.memory}</argLine>
-                    <testFailureIgnore>false</testFailureIgnore>
-                    <skip>false</skip>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-    <reporting>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <version>2.9</version>
-            </plugin>
-        </plugins>
-    </reporting>
-
-    <repositories>
-        <repository>
-            <id>ranides.net</id>
-            <name>ranides.net</name>
-            <url>http://maven.ranides.net</url>
-        </repository>
-    </repositories>
-    
-    <dependencies>
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <version>1.2.16</version>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.10</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-            <version>3.1</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-core</artifactId>
-            <version>2.0.1</version>
-            <type>jar</type>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.datatype</groupId>
-            <artifactId>jackson-datatype-json-org</artifactId>
-            <version>2.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>net.ranides</groupId>
-            <artifactId>caliper</artifactId>
-            <version>1.0L</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>net.ranides</groupId>
-            <artifactId>assira.asm</artifactId>
-            <version>4.2</version>
-        </dependency>
-        <dependency>
-            <groupId>eu.vitaliy</groupId>
-            <artifactId>mazovia-charset</artifactId>
-            <version>1.0</version>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>joda-time</groupId>
-            <artifactId>joda-time</artifactId>
-            <version>2.1</version>
-        </dependency>
-        <dependency>
-            <groupId>net.ranides</groupId>
-            <artifactId>strom</artifactId>
-            <version>1.0</version>
-        </dependency>
-    </dependencies>
-</project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" 
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>net.ranides</groupId>
+    <artifactId>assira</artifactId>
+    <version>0.80.1</version>
+    <packaging>jar</packaging>
+
+    <name>assira1</name>
+    <url>http://ranides.net/projects/assira</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <netbeans.hint.license>WTFPL</netbeans.hint.license>
+        <project.test.memory>512m</project.test.memory>
+        <project.argLine></project.argLine>
+    </properties>
+    
+    <distributionManagement>
+        <repository>
+            <id>maven.ranides.net</id>
+            <name>maven.ranides.net</name>
+            <url>ftp://maven.ranides.net/</url>
+        </repository>
+    </distributionManagement>
+    
+    <build>
+        <extensions>
+            <extension>
+                <groupId>org.apache.maven.wagon</groupId>
+                <artifactId>wagon-ftp</artifactId>
+                <version>1.0</version>
+            </extension>
+        </extensions>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <source>1.7</source>
+                    <target>1.7</target>
+                    <compilerArgument>-Xlint:unchecked</compilerArgument>
+                    <compilerArgument>-proc:none</compilerArgument>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-pmd-plugin</artifactId>
+                <version>3.5</version>
+                <configuration>
+                    <rulesets>
+                        <ruleset>http://ranides.net/projects/pmd/3/assira.custom.xml</ruleset>
+                        <ruleset>http://ranides.net/projects/pmd/3/assira.standard.xml</ruleset>
+                        <!--
+                        <ruleset>http://dev.ranides.vnet/java/assira.custom.xml</ruleset>
+                        <ruleset>http://dev.ranides.vnet/java/assira.standard.xml</ruleset>
+                        -->
+                    </rulesets>
+                </configuration>
+            </plugin>
+            <!--
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>cobertura-maven-plugin</artifactId>
+                <version>2.5.2</version>
+            </plugin>
+            -->
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <version>0.7.5.201505241946</version>
+                <configuration>
+                    <propertyName>project.argLine</propertyName>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>prepare-agent</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>report</id>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>report</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.9</version>
+                <executions>
+                    <execution>
+                        <id>javadocs-site</id>
+                        <phase>site</phase>
+                        <goals>
+                            <goal>javadoc</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <links>
+                        <link>http://download.oracle.com/javase/1.6.0/docs/api/</link>
+                    </links>
+                    <version>true</version>
+                    <show>public</show>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <version>2.2.1</version>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <goals>
+                            <goal>jar-no-fork</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18.1</version>
+                <configuration>
+                    <argLine>@{project.argLine} -Xmx${project.test.memory}</argLine>
+                    <testFailureIgnore>false</testFailureIgnore>
+                    <skip>false</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.9</version>
+            </plugin>
+        </plugins>
+    </reporting>
+
+    <repositories>
+        <repository>
+            <id>ranides.net</id>
+            <name>ranides.net</name>
+            <url>http://maven.ranides.net</url>
+        </repository>
+    </repositories>
+    
+    <dependencies>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.16</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.10</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+            <version>2.0.1</version>
+            <type>jar</type>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.datatype</groupId>
+            <artifactId>jackson-datatype-json-org</artifactId>
+            <version>2.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>net.ranides</groupId>
+            <artifactId>caliper</artifactId>
+            <version>1.0L</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>net.ranides</groupId>
+            <artifactId>assira.asm</artifactId>
+            <version>4.2</version>
+        </dependency>
+        <dependency>
+            <groupId>eu.vitaliy</groupId>
+            <artifactId>mazovia-charset</artifactId>
+            <version>1.0</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>joda-time</groupId>
+            <artifactId>joda-time</artifactId>
+            <version>2.1</version>
+        </dependency>
+        <dependency>
+            <groupId>net.ranides</groupId>
+            <artifactId>strom</artifactId>
+            <version>1.0</version>
+        </dependency>
+    </dependencies>
+</project>

+ 4 - 0
assira1/src/main/java/net/ranides/assira/text/StringUtils.java

@@ -488,5 +488,9 @@ public final class StringUtils {
     public static String escapeRegex(String text) {
         return REGEX_SPECIAL.matcher(text).replaceAll("\\\\$1");
     }
+	
+	public static Pattern compileWildcard(String wildcard) {
+		return Pattern.compile(StringUtils.escapeRegex(wildcard).replace("\\*", ".*"));
+	}
     
 }