javax0.jamal.tools.param.PatternParameter Maven / Gradle / Ivy
package javax0.jamal.tools.param;
import javax0.jamal.api.BadSyntax;
import javax0.jamal.tools.Params;
import java.util.regex.Pattern;
public class PatternParameter extends AbstractTypedParameter {
public PatternParameter(Params.Param param) {
super(param);
}
public Pattern get() throws BadSyntax {
return param.get();
}
public PatternParameter required() {
return this;
}
public PatternParameter optional() {
param.orElseNull();
return this;
}
public PatternParameter defaultValue(String dV) {
if (dV == null) {
param.orElseNull();
} else {
param.defaultValue(dV);
}
return this;
}
}