javax0.jamal.tools.param.IntegerParameter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jamal-tools Show documentation
Show all versions of jamal-tools Show documentation
-in Jamal macro library support tools
package javax0.jamal.tools.param;
import javax0.jamal.api.BadSyntax;
import javax0.jamal.tools.Params;
public class IntegerParameter extends AbstractTypedParameter {
public IntegerParameter(Params.Param param) {
super(param);
}
public int get() throws BadSyntax {
return param.get();
}
public IntegerParameter required() {
return this;
}
public IntegerParameter optional() {
return defaultValue(0);
}
public IntegerParameter defaultValue(Integer dV) {
if (dV == null) {
param.orElseNull();
} else {
param.defaultValue(dV);
}
return this;
}
}