Class WildcardPattern


  • public class WildcardPattern
    extends java.lang.Object
    The Class WildcardPattern.

    The following standard quantifiers are recognized:

    *
    matches single character
    +
    matches one or more characters
    ?
    matches zero or more characters
    **
    matches zero or more string delimited by separators
    \
    Wildcard characters can be escaped

    Examples

    /static/*
    /static/a.jpg
    /static*/**/b/*
    matches one or more characters
    /static*/**
    /static/a/a.jpg
    **/static/**
    a/b/static/a/b/c/a.jpg
    /static-?/a??.jpg
    /static-a/abc.jpg
    • Constructor Summary

      Constructors 
      Constructor Description
      WildcardPattern​(java.lang.String patternString)  
      WildcardPattern​(java.lang.String patternString, char separator)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static WildcardPattern compile​(java.lang.String patternString)  
      static WildcardPattern compile​(java.lang.String patternString, char separator)  
      boolean equals​(java.lang.Object obj)  
      char getSeparator()  
      protected char[] getTokens()  
      protected int[] getTypes()  
      float getWeight()  
      int hashCode()  
      static boolean hasWildcards​(java.lang.String str)  
      java.lang.String mask​(java.lang.String nakedString)
      Erase the characters that corresponds to the wildcard, and returns collect only the remaining characters.
      boolean matches​(java.lang.String compareString)
      If the pattern matches then returns true.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • WildcardPattern

        public WildcardPattern​(java.lang.String patternString)
      • WildcardPattern

        public WildcardPattern​(java.lang.String patternString,
                               char separator)
    • Method Detail

      • getSeparator

        public char getSeparator()
      • getTokens

        protected char[] getTokens()
      • getTypes

        protected int[] getTypes()
      • getWeight

        public float getWeight()
      • matches

        public boolean matches​(java.lang.String compareString)
        If the pattern matches then returns true.
        Parameters:
        compareString - the compare string
        Returns:
        true, if successful
      • mask

        public java.lang.String mask​(java.lang.String nakedString)
        Erase the characters that corresponds to the wildcard, and returns collect only the remaining characters. In other words, only it remains for the wildcard character.
        Parameters:
        nakedString - the naked string
        Returns:
        the masked string
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • compile

        public static WildcardPattern compile​(java.lang.String patternString)
      • compile

        public static WildcardPattern compile​(java.lang.String patternString,
                                              char separator)
      • hasWildcards

        public static boolean hasWildcards​(java.lang.String str)