View Javadoc

1   /*
2    RegularExpressionConstants.java
3    Creation date : 14/07/2010
4    Copyright © Benjamin Croizet (graffity2199@yahoo.fr)
5   
6    This program is free software; you can redistribute it and/or
7    modify it under the terms of the GNU General Public License
8    or GNU Lesser General Public License as published by the
9    Free Software Foundation; either version 3 of the License,
10   or (at your option) any later version.
11  
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16  
17   You should have received copies of the GNU General Public License
18   and GNU Lesser General Public License along with this program;
19   if not, write to the Free Software Foundation, Inc.,
20   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21   http://www.fsf.org/licensing/licenses/gpl.html
22   http://www.gnu.org/licenses/lgpl.html
23   */
24  
25  package net.sourceforge.plantumldependency.cli.constants;
26  
27  import static java.util.regex.Pattern.compile;
28  
29  import java.util.regex.Pattern;
30  
31  /**
32   * The class which stores all necessary regular expressions constants.
33   *
34   * @author Benjamin Croizet (<a href="mailto:graffity2199@yahoo.fr>graffity2199@yahoo.fr</a>)
35   * @since 1.0.0
36   * @version 1.3.0
37   */
38  public final class RegularExpressionConstants {
39  
40      /** The pattern representing annotations. */
41      public static final Pattern ANNOTATIONS_REGEXP = compile("@ *([\\w\\.]*)");
42  
43      /** The pattern representing the java type. */
44      public static final Pattern JAVA_TYPE_REGEXP = compile("[\\w.]* *(?:public|final|) *(abstract|) *(?:public|final|) *(class|interface|enum|@interface) +([\\w. <>,]*?)(?: +extends +([\\w. <>,]*?)|)(?: +implements +([\\w. <>,]*?)|) *\\{");
45  
46      /** The pattern representing the native methods. */
47      public static final Pattern NATIVE_METHODS_REGEXP = compile("native +.* +[\\w]* *\\( *\\)? *;");
48  
49      /** The pattern representing the java package. */
50      public static final Pattern PACKAGE_REGEXP = compile("package +([\\w. ]*?) *;");
51  
52      /** The pattern representing the standard import. */
53      public static final Pattern STANDARD_IMPORT_REGEXP = compile("import +(?:((?:\\w* *\\. *)*\\w*) *\\. *)*(\\w*) *;");
54  
55      /** The pattern representing the static import. */
56      public static final Pattern STATIC_IMPORT_REGEXP = compile("import +static +([\\w. ]+)\\.([\\w.]+?)\\.(?:.*?) *;");
57  
58      /**
59       * Private constructor to prevent from instantiation.
60       *
61       * @since 1.0.0
62       */
63      private RegularExpressionConstants() {
64          super();
65      }
66  }