import java.util.Arrays;
import java.util.List;
+import jalview.ws.params.ArgumentI;
+
public class BooleanOption extends Option
{
public static class Builder extends Option.Builder
{
this(name, description, label, isrequired, defValue, String.valueOf(true), link);
}
+
+ public static Boolean parseBoolean(ArgumentI argument)
+ {
+ return argument.getValue() != null && !argument.getValue().isEmpty() ?
+ true : false;
+ }
}
package jalview.ws.params.simple;
+import jalview.ws.params.ArgumentI;
import jalview.ws.params.ParameterI;
import jalview.ws.params.ValueConstrainI;
{
return new DoubleParameter(this);
}
+
+ /**
+ * Return argument value as double or null if string value is null or empty.
+ *
+ * @param arg argument to extract value form
+ * @return argument value as double
+ */
+ public static Double parseDouble(ArgumentI arg)
+ {
+ return arg.getValue() != null && !arg.getValue().isEmpty() ?
+ Double.parseDouble(arg.getValue()) : null;
+ }
+
+ /**
+ * Return argument value as float or null if string value is null or empty.
+ *
+ * @param arg argument to extract value from
+ * @return value as float
+ */
+ public static Float parseFloat(ArgumentI arg)
+ {
+ return arg.getValue() != null && !arg.getValue().isEmpty() ?
+ Float.parseFloat(arg.getValue()) : null;
+ }
}
*/
package jalview.ws.params.simple;
+import jalview.ws.params.ArgumentI;
import jalview.ws.params.ParameterI;
import jalview.ws.params.ValueConstrainI;
return new IntegerParameter(this);
}
+ /**
+ * Return argument value as int or null if string value is null or empty.
+ *
+ * @param arg argument to extract value from
+ * @return value as int
+ */
+ public static Integer parseInt(ArgumentI arg)
+ {
+ return arg.getValue() != null && !arg.getValue().isEmpty() ?
+ Integer.parseInt(arg.getValue()) : null;
+ }
+
}