IMI-Application/src/main/java/de/vanitasvitae/imi/codes/types/SampleType.java

26 lines
860 B
Java

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