Class PatternUtil


  • public class PatternUtil
    extends java.lang.Object
    Ease use of regular expressions on heap objects.
    • if the pattern does not contain one of the expressions .* !^ (at the beginning) $ (at the end), then a .* is added at the beginning and at the end of the pattern
    • if the pattern contains [], it is replaced by \[\]
    • if the pattern contains $ not at the end (inner classes), it is replaced by \$
    • Constructor Summary

      Constructors 
      Constructor Description
      PatternUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String smartFix​(java.lang.String pattern)
      Fix up a pattern to be a true regular expression pattern.
      static java.lang.String smartFix​(java.lang.String pattern, boolean addDotStars)
      Fix up a pattern to be a true regular expression pattern.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PatternUtil

        public PatternUtil()
    • Method Detail

      • smartFix

        public static java.lang.String smartFix​(java.lang.String pattern)
        Fix up a pattern to be a true regular expression pattern. Add dots and starts at the beginning and end if not already there.
        Parameters:
        pattern - the pattern used for matching class names
        Returns:
        the fixed-up pattern a true Regex pattern
      • smartFix

        public static java.lang.String smartFix​(java.lang.String pattern,
                                                boolean addDotStars)
        Fix up a pattern to be a true regular expression pattern.
        Parameters:
        pattern - the almost RegEx pattern
        addDotStars - if true then if the pattern does not contain one of the expressions .* !^ (at the beginning) $ (at the end), then a .* is added at the beginning and at the end of the pattern.
        Returns:
        the fixed-up pattern