DocCheck 1.2 Beta 2

com.sun.tools.doclets.util
Class FileSpecifier

java.lang.Object
  |
  +--com.sun.tools.doclets.util.FileSpecifier

public class FileSpecifier
extends java.lang.Object

Filename specifier. Allows patterns at each level of the path. For example: d*.C*Tracker matches docutil.ClassTracker and docutil.ConstrTracker.

Note:
A final * character in the directory-path part of the pathname matches all sub-packages. So java.awt.*.Foo* matches all files that start with "Foo" in all subpackages under java.awt. To keep from recognizing subpackages, specify "?*" as the last directory entry. The specification java.awt.?*.Foo*, therefore, matches only those classes that start with Foo that are in subpackages immediately under java.awt.
By default, paths are assumed to be separated by the default seperator character for the current system ("/" for Unix, "\" for DOS). The path separator can also be specified, both when creating the specifier and when invoking the match(String, String) function. That allows a filename specifier to be created with a dot-separator, for example, and yet be successfully compared to a file system pathname.
Note:
A null pattern matches everything. The match(java.lang.String) function always returns true. However, when a null string, is compared to any pattern, the null string always returns false. (A null string matches nothing.) When a null string is compared to a null pattern, the result is false. (The null string takes precedence.)

Author:
Eric Armstrong
See Also:
Specifier, PathSpecifier

Field Summary
protected  Specifier nameSpec
           
protected  PathSpecifier pathSpec
           
 
Constructor Summary
FileSpecifier(java.util.List pList)
          Create a specifier using a pre-separated list of directory-name patterns.
FileSpecifier(java.util.List pList, java.lang.String aSeparator)
          Create a specifier using a pre-separated list of directory-name patterns, specifying the separator that was used to break them apart.
FileSpecifier(java.lang.String pattern)
          Create a specifier using the default directory-seperator for the current system, where the separator is used to divide the input string.
FileSpecifier(java.lang.String s, java.lang.String aSeparator)
          Create a specifier using the specified directory-seperator, where the separator is used to divide the input string.
 
Method Summary
protected  void initSpec(java.util.List pList)
          Initialize this specifier
 boolean match(java.lang.String s)
          Check the string argument to see if it matches this specifier, where the default directory-seperator for the current system is used to divide the input string into directory-name segments.
 boolean match(java.lang.String path, java.lang.String separator)
          Check the string argument to see if it matches this specifier, where the specified seperator is used to divide the input string into directory-name segments.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pathSpec

protected PathSpecifier pathSpec

nameSpec

protected Specifier nameSpec
Constructor Detail

FileSpecifier

public FileSpecifier(java.lang.String pattern)
Create a specifier using the default directory-seperator for the current system, where the separator is used to divide the input string.

Parameters:
pattern - the pattern to match (ex: j*\Foo*Bar)

FileSpecifier

public FileSpecifier(java.lang.String s,
                     java.lang.String aSeparator)
Create a specifier using the specified directory-seperator, where the separator is used to divide the input string. Note:
The separator is assumed to contain a single character, although it could also contain multiple characters, each of which acts as a separator. On no account can it contain multiple characters which act as a single separator.

Parameters:
s - the pattern to match (ex: j*\Foo*Bar)
aSeparator - the directory-name separator -- "/" for Unix, "\" for DOS, "." for packages.

FileSpecifier

public FileSpecifier(java.util.List pList)
Create a specifier using a pre-separated list of directory-name patterns.

Parameters:
pList - a list of Strings
Throws:
java.lang.ClassCastException - if the list entries are not strings

FileSpecifier

public FileSpecifier(java.util.List pList,
                     java.lang.String aSeparator)
Create a specifier using a pre-separated list of directory-name patterns, specifying the separator that was used to break them apart. (Used in toString().)

Parameters:
pList - a list of Strings
aSeparator - the directory-name separator
Throws:
java.lang.ClassCastException - if the list entries are not strings
Method Detail

initSpec

protected void initSpec(java.util.List pList)
Initialize this specifier

Parameters:
pList - a list of Strings
Throws:
java.lang.ClassCastException - if the list entries are not strings

match

public boolean match(java.lang.String s)
Check the string argument to see if it matches this specifier, where the default directory-seperator for the current system is used to divide the input string into directory-name segments.

Parameters:
s - the string to match
Returns:
true if the string matche this specifier

match

public boolean match(java.lang.String path,
                     java.lang.String separator)
Check the string argument to see if it matches this specifier, where the specified seperator is used to divide the input string into directory-name segments.

Parameters:
path - the directory-path string to match
separator - the directory-name separator -- "/" for Unix, "\" for DOS, "." for packages.
Returns:
true if the string matche this specifier

toString

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

DocCheck 1.2 Beta 2

Report a bug or suggest a feature
Copyright 2000-2003 Sun Microsystems, Inc. 4150 Network Circle
Santa Clara, CA 95054, U.S.A. All Rights Reserved.