--- /dev/null
+package eu.svjatoslav.commons.cli_helper.parameter_parser.parameter;
+
+import eu.svjatoslav.commons.cli_helper.parameter_parser.Option;
+import eu.svjatoslav.commons.cli_helper.parameter_parser.ParameterCount;
+
+public class FloatOption extends Option<Float, FloatOption> {
+
+ public FloatOption(final String description) {
+ super(description, ParameterCount.ONE);
+ }
+
+ @Override
+ public java.lang.String describeFormat() {
+ return "Float.";
+ }
+
+ @Override
+ public Float getValue() {
+ if (parameters.size() != 1)
+ throw new RuntimeException("Parameter " + description
+ + " shall have exactly 1 argument.");
+ return Float.parseFloat(parameters.get(0));
+ }
+
+ @Override
+ public boolean isValid(final java.lang.String value) {
+ try {
+ java.lang.Float.valueOf(value);
+ return true;
+ } catch (final NumberFormatException e) {
+ return false;
+ }
+ }
+}
+