23 lines
748 B
Java
23 lines
748 B
Java
package de.vanitasvitae.imi.codes;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
/**
|
|
* Sub-class of {@link CharSequence}, which can only represent char sequences of length 3 from the alphabet [a-zA-Z0-9].
|
|
*/
|
|
public class StudyNumber extends BoundedCharSequence {
|
|
|
|
private static final Pattern REGEX = Pattern.compile(InputValidator.REGEX_ALPHABET + "{3}");
|
|
|
|
/**
|
|
* Create a new {@link StudyNumber} sequence. The constructor checks, whether the input String is of length 3 and from
|
|
* the alphabet [a-zA-Z9-0].
|
|
*
|
|
* @param value input string
|
|
* @throws InvalidOptionException if the input doesn't match the regex
|
|
*/
|
|
protected StudyNumber(String value) throws InvalidOptionException {
|
|
super(REGEX, value);
|
|
}
|
|
}
|