[LIB-13] Lazy scanners init, scan by URL and rename API functions
[chesshog-scanner.git] / src / main / java / org / hedgecode / chess / scanner / ChessHogScannerProperties.java
index e7565bc..fdead40 100644 (file)
@@ -73,7 +73,7 @@ public class ChessHogScannerProperties {
     private static final String EMPTY = "";
 
     /**
-     * Gets property value.
+     * Gets string property value.
      *
      * @param key Property key.
      * @return Property value (possibly empty string, but never {@code null}).
@@ -83,6 +83,35 @@ public class ChessHogScannerProperties {
     }
 
     /**
+     * Gets boolean property value.
+     *
+     * @param key Property key.
+     * @return Property value ({@code false} by default).
+     */
+    public static boolean is(String key) {
+        return Boolean.parseBoolean(
+                PROPERTIES.getProperty(key, Boolean.FALSE.toString())
+        );
+    }
+
+    /**
+     * Zero integer for not found properties.
+     */
+    private static final String ZERO = "0";
+
+    /**
+     * Gets integer property value.
+     *
+     * @param key Property key.
+     * @return Property value ({@code 0} by default).
+     */
+    public static int getInt(String key) {
+        return Integer.parseInt(
+                PROPERTIES.getProperty(key, ZERO)
+        );
+    }
+
+    /**
      * Private constructor.
      */
     private ChessHogScannerProperties() {