All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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() {
        checkDone(DoneAction.REQUIRED);
        return this;
    }

    public PatternParameter optional() {
        checkDone(DoneAction.OPTIONAL);
        param.orElseNull();
        return this;
    }

    public PatternParameter defaultValue(String dV) {
        checkDone(DoneAction.DEFAULT);
        if (dV == null) {
            param.orElseNull();
        } else {
            param.defaultValue(dV);
        }
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy