net.sourceforge.pmd.rules.regex
Class RegexHelper

java.lang.Object
  extended by net.sourceforge.pmd.rules.regex.RegexHelper

public class RegexHelper
extends java.lang.Object

A simple helper class to regroup a bunch of method generally used by rules using regex.

Author:
Romain PELISSE, belaran@gmail.com

Method Summary
static java.util.List<java.util.regex.Pattern> compilePatternsFromList(java.util.List<java.lang.String> list)
          Compiles a list of regex into a list of patterns.
static boolean isMatch(java.util.regex.Pattern pattern, java.lang.String subject)
          Simple commodity method (also designed to increase readability of source code, and to decrease import in the calling class).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

compilePatternsFromList

public static java.util.List<java.util.regex.Pattern> compilePatternsFromList(java.util.List<java.lang.String> list)
Compiles a list of regex into a list of patterns.

Parameters:
list - the regex list
Returns:
the pattern list

isMatch

public static boolean isMatch(java.util.regex.Pattern pattern,
                              java.lang.String subject)
Simple commodity method (also designed to increase readability of source code, and to decrease import in the calling class). Provide a pattern and a subject, it'll do the proper matching.

Parameters:
pattern - a compiled regex pattern
subject - a String to match
Returns:
true if there is a match; false otherwise


Copyright © 2002-2011 InfoEther. All Rights Reserved.