modules/jdk.packager/src/main/java/com/oracle/tools/packager/JreUtils.java

Print this page




  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.oracle.tools.packager;
  27 
  28 import java.io.File;
  29 import java.util.HashSet;
  30 import java.util.Set;
  31 




  32 public class JreUtils {
  33 
  34     public static class Rule {
  35         String regex;
  36         boolean includeRule;
  37         Type type;
  38         enum Type {SUFFIX, PREFIX, SUBSTR, REGEX}
  39 
  40         private Rule(String regex, boolean includeRule, Type type) {
  41             this.regex = regex;
  42             this.type = type;
  43             this.includeRule = includeRule;
  44         }
  45 
  46         boolean match(String str) {
  47             if (type == Type.SUFFIX) {
  48                 return str.endsWith(regex);
  49             }
  50             if (type == Type.PREFIX) {
  51                 return str.startsWith(regex);




  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.oracle.tools.packager;
  27 
  28 import java.io.File;
  29 import java.util.HashSet;
  30 import java.util.Set;
  31 
  32 /**
  33  * @deprecated use {@link ToolProvider} to locate the {@code "javapackager"} tool instead.
  34  */
  35 @Deprecated(since="10", forRemoval=true)
  36 public class JreUtils {
  37 
  38     public static class Rule {
  39         String regex;
  40         boolean includeRule;
  41         Type type;
  42         enum Type {SUFFIX, PREFIX, SUBSTR, REGEX}
  43 
  44         private Rule(String regex, boolean includeRule, Type type) {
  45             this.regex = regex;
  46             this.type = type;
  47             this.includeRule = includeRule;
  48         }
  49 
  50         boolean match(String str) {
  51             if (type == Type.SUFFIX) {
  52                 return str.endsWith(regex);
  53             }
  54             if (type == Type.PREFIX) {
  55                 return str.startsWith(regex);