Class TwoColumnValidator
java.lang.Object
TwoColumnValidator
- All Implemented Interfaces:
- Validator
- Direct Known Subclasses:
- CodebookValidator, FrequencyValidator
public abstract class TwoColumnValidator
- extends Object
- implements Validator
An abstract class to provide support for validating dialogs
in which the entered text is expected to represent some form
of key/value pairs, one per line, separated by one or more spaces.
Lines that have only whitespace will be ignored. Lines with only
one token will be interpreted as having a single space (" ") as the
input string, and the remaining token as the key. Lines with two
tokens will be interpreted as key/value pairs.
Inputs having a line with more than two tokens, or two or more lines
using the same key, will be considered invalid.
Parse returns an instance of LinkedHashMap<String, String>.
Method Summary |
Object |
parse(String original)
Parses the original text to form a map from string to string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TwoColumnValidator
public TwoColumnValidator()
parse
public Object parse(String original)
throws ValidatorException
- Parses the original text to form a map from string to string.
Relies on input conventions documented in the class overview.
- Specified by:
parse
in interface Validator
- Parameters:
original
- contents of the text area
- Returns:
- LinkedHashMap<String,String> instance with pairs given in order
that they were entered.
- Throws:
ValidatorException
- if any line has more than two tokens,
or if there are no nonempty lines.