public static class SpoofChecker.Builder extends Object
Constructor and Description |
---|
SpoofChecker.Builder()
Constructor: Create a default Unicode Spoof Checker Builder, configured to perform all checks except for
LOCALE_LIMIT and CHAR_LIMIT.
|
SpoofChecker.Builder(SpoofChecker src)
Constructor: Create a Spoof Checker Builder, and set the configuration from an existing SpoofChecker.
|
Modifier and Type | Method and Description |
---|---|
SpoofChecker |
build()
Create a SpoofChecker with current configuration.
|
SpoofChecker.Builder |
setAllowedChars(UnicodeSet chars)
Limit the acceptable characters to those specified by a Unicode Set.
|
SpoofChecker.Builder |
setAllowedLocales(Set<ULocale> locales)
Limit characters that are acceptable in identifiers being checked to those normally used with the languages
associated with the specified locales.
|
SpoofChecker.Builder |
setChecks(int checks)
Specify the set of checks that will be performed by the check functions of this Spoof Checker.
|
SpoofChecker.Builder |
setData(Reader confusables,
Reader confusablesWholeScript)
Specify the source form of the spoof data Spoof Checker.
|
SpoofChecker.Builder |
setRestrictionLevel(SpoofChecker.RestrictionLevel restrictionLevel)
Set the loosest restriction level allowed.
|
public SpoofChecker.Builder()
public SpoofChecker.Builder(SpoofChecker src)
src
- The existing checker.public SpoofChecker build()
public SpoofChecker.Builder setData(Reader confusables, Reader confusablesWholeScript) throws ParseException, IOException
confusables
- the Reader of confusable characters definitions, as found in file confusables.txt from
unicode.org.confusablesWholeScript
- the Reader of whole script confusables definitions, as found in the file
xonfusablesWholeScript.txt from unicode.org.ParseException
- To report syntax errors in the input.IOException
public SpoofChecker.Builder setChecks(int checks)
checks
- The set of checks that this spoof checker will perform. The value is an 'or' of the desired
checks.public SpoofChecker.Builder setAllowedLocales(Set<ULocale> locales)
locales
- A Set of ULocales, from which the language and associated script are extracted. If the locales Set
is null, no restrictions will be placed on the allowed characters.public SpoofChecker.Builder setAllowedChars(UnicodeSet chars)
chars
- A Unicode Set containing the list of characters that are permitted. The incoming set is cloned by
this function, so there are no restrictions on modifying or deleting the UnicodeSet after calling
this function. Note that this clears the allowedLocales set.public SpoofChecker.Builder setRestrictionLevel(SpoofChecker.RestrictionLevel restrictionLevel)
restrictionLevel
- The loosest restriction level allowed.Copyright (c) 2013 IBM Corporation and others.