X-Git-Url: https://git.hedgecode.org/?p=chesshog-scanner.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fhedgecode%2Fchess%2Fscanner%2FChessHogScannerProperties.java;fp=src%2Fmain%2Fjava%2Forg%2Fhedgecode%2Fchess%2Fscanner%2FChessHogScannerProperties.java;h=fdead4048fc04ded1b16c4bb051cc80c8a8058f4;hp=e7565bc25f91204a87af63b25c723aa841947815;hb=c6cec94b865c1dc50ef1699aa4e73e1fc519198b;hpb=22aac3a325356cfd433a7f9d93e2df49550fb583 diff --git a/src/main/java/org/hedgecode/chess/scanner/ChessHogScannerProperties.java b/src/main/java/org/hedgecode/chess/scanner/ChessHogScannerProperties.java index e7565bc..fdead40 100644 --- a/src/main/java/org/hedgecode/chess/scanner/ChessHogScannerProperties.java +++ b/src/main/java/org/hedgecode/chess/scanner/ChessHogScannerProperties.java @@ -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() {