Refactored exception dialog.
[svjatoslav_commons.git] / src / main / java / eu / svjatoslav / commons / commandline / parameterparser / parameter / IntegerParameter.java
index ca8e06f..3aacf57 100755 (executable)
@@ -1,43 +1,38 @@
 /*
- * Svjatoslav Commons - shared library of common functionality.
- * Copyright ©2012-2014, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 3 of the GNU Lesser General Public License
- * or later as published by the Free Software Foundation.
+ * Svjatoslav Commons - shared library of common functionality. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
  */
-
 package eu.svjatoslav.commons.commandline.parameterparser.parameter;
 
 import eu.svjatoslav.commons.commandline.parameterparser.ArgumentCount;
 import eu.svjatoslav.commons.commandline.parameterparser.Parameter;
 
-public class IntegerParameter extends Parameter<IntegerParameter> {
+public class IntegerParameter extends Parameter<Integer, IntegerParameter> {
 
-       public IntegerParameter(final String description) {
-               super(description, ArgumentCount.SINGLE);
-       }
+    public IntegerParameter(final String description) {
+        super(description, ArgumentCount.SINGLE);
+    }
 
-       @Override
-       public java.lang.String describeFormat() {
-               return "integer";
-       }
+    @Override
+    public java.lang.String describeFormat() {
+        return "integer";
+    }
 
-       @Override
-       public Integer getValue() {
-               if (arguments.size() != 1)
-                       throw new RuntimeException("Parameter " + description
-                                       + " shall have exactly 1 argument.");
-               return Integer.parseInt(arguments.get(0));
-       }
+    @Override
+    public Integer getValue() {
+        if (arguments.size() != 1)
+            throw new RuntimeException("Parameter " + description
+                    + " shall have exactly 1 argument.");
+        return Integer.parseInt(arguments.get(0));
+    }
 
-       @Override
-       public boolean validate(final java.lang.String value) {
-               try {
-                       java.lang.Integer.valueOf(value);
-                       return true;
-               } catch (final NumberFormatException e) {
-                       return false;
-               }
-       }
+    @Override
+    public boolean validate(final java.lang.String value) {
+        try {
+            java.lang.Integer.valueOf(value);
+            return true;
+        } catch (final NumberFormatException e) {
+            return false;
+        }
+    }
 }