nu.staldal.lagoon.util
Class Wildcard

java.lang.Object
  extended by nu.staldal.lagoon.util.Wildcard

public final class Wildcard
extends java.lang.Object

Wildcard processing methods. All methods in this class are static. A wildcard pattern consists of one or more simple patterns, separated by ';'. A simple pattern may contain one '*' which match any string (including the empty string).


Method Summary
static java.lang.String instantiateWildcard(java.lang.String pattern, java.lang.String part)
          Instantiate a wildcard pattern to a filename.
static boolean isWildcard(java.lang.String pattern)
          Check if a wildcard pattern can possibly match more than one filename.
static java.lang.String matchWildcard(java.lang.String pattern, java.lang.String filename)
          Attempt to match a filename matches to wildcard pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isWildcard

public static boolean isWildcard(java.lang.String pattern)
Check if a wildcard pattern can possibly match more than one filename.

Parameters:
pattern - the wildcard pattern to test

matchWildcard

public static java.lang.String matchWildcard(java.lang.String pattern,
                                             java.lang.String filename)
Attempt to match a filename matches to wildcard pattern.

Parameters:
pattern - the wildcard pattern
filename - the filename
Returns:
the string substituted into the pattern, or null if no match could be made

instantiateWildcard

public static java.lang.String instantiateWildcard(java.lang.String pattern,
                                                   java.lang.String part)
Instantiate a wildcard pattern to a filename.

Parameters:
pattern - the wildcard pattern
part - the string to substitue into the pattern (returned from matchWildcard)
Returns:
the filename
See Also:
matchWildcard(java.lang.String, java.lang.String)