Package org.passay.dictionary
Class DictionaryBuilder
- java.lang.Object
-
- org.passay.dictionary.DictionaryBuilder
-
public class DictionaryBuilder extends Object
Builder for common dictionary usage. Creates aWordListDictionary
backed by anArrayWordList
from one or more files containing a list of words, one per line.- Author:
- Middleware Services
-
-
Constructor Summary
Constructors Constructor Description DictionaryBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DictionaryBuilder
addFile(String path)
Adds a word list to the dictionary to be built.DictionaryBuilder
addReader(Reader reader)
Adds a word list to the dictionary to be built.Dictionary
build()
Builds a dictionary from the configured properties.DictionaryBuilder
setCaseSensitive(boolean flag)
Sets the case sensitivity flag on the dictionary to be built.
-
-
-
Method Detail
-
addFile
public DictionaryBuilder addFile(String path)
Adds a word list to the dictionary to be built. The file is read using the platform default charset.- Parameters:
path
- Path to word list, one word per line.- Returns:
- This builder.
-
addReader
public DictionaryBuilder addReader(Reader reader)
Adds a word list to the dictionary to be built.- Parameters:
reader
- Reader which returns a word list, one word per line.- Returns:
- This builder.
-
setCaseSensitive
public DictionaryBuilder setCaseSensitive(boolean flag)
Sets the case sensitivity flag on the dictionary to be built. Dictionaries are built case insensitive by default.- Parameters:
flag
- True for case sensitive, false otherwise.- Returns:
- This builder.
-
build
public Dictionary build()
Builds a dictionary from the configured properties.- Returns:
- New
WordListDictionary
instance.
-
-