public class SyntaxMatcher extends Object
Constructor and Description |
---|
SyntaxMatcher(Locale locale)
Constructs the syntax compiler in the context of the given locale.
|
Modifier and Type | Method and Description |
---|---|
void |
addPackage(SyntaxPackage syntaxPackage)
Registers the given set of packages with this matcher.
|
void |
addPackages(Set<SyntaxPackage> packages)
Registers the given set of packages with this matcher.
|
Locale |
getLocale()
Returns the locale with which this matcher is associated.
|
Syntax |
getMatchingSyntax(String[] args,
Parameters parameters)
Matches command-line arguments against pre-compiled set of syntaxes.
|
Set<SyntaxPackage> |
getPackages()
Returns an unmodifiable copy of the set of registered packages.
|
List<Syntax> |
getSyntaxes()
Returns an unmodifiable copy of the prioritized syntax list.
|
public SyntaxMatcher(Locale locale)
locale
- Locale context to use for matching the otherwise
locale-independent syntax.public Locale getLocale()
public void addPackage(SyntaxPackage syntaxPackage)
syntaxPackage
- syntax package to be addedpublic void addPackages(Set<SyntaxPackage> packages)
packages
- set of syntax packages to be addedpublic Set<SyntaxPackage> getPackages()
public List<Syntax> getSyntaxes()
public Syntax getMatchingSyntax(String[] args, Parameters parameters) throws BadUsageException
args
- Command-line arguments to be parsed.parameters
- Parameter map to be populated (on success) with
string name to serializable object bindings. syntax definitions.Syntax
instance that successfully matched the specified
command-line argumentsBadUsageException
- thrown if the specified arguments failed to
match any of the syntaxes registered with this matcher.Copyright © 2015. All Rights Reserved.