From ca9f1741714ac968d872555946fdb902f231e122 Mon Sep 17 00:00:00 2001 From: zzz Date: Tue, 2 Mar 2010 22:52:26 +0000 Subject: [PATCH] * Context: Add boolean getProperty methods --- core/java/src/net/i2p/I2PAppContext.java | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/core/java/src/net/i2p/I2PAppContext.java b/core/java/src/net/i2p/I2PAppContext.java index 974b69b84..c95065a73 100644 --- a/core/java/src/net/i2p/I2PAppContext.java +++ b/core/java/src/net/i2p/I2PAppContext.java @@ -352,6 +352,32 @@ public class I2PAppContext { return ival; } + /** + * Return a boolean with a boolean default + * @since 0.7.12 + */ + public boolean getProperty(String propName, boolean defaultVal) { + String val = getProperty(propName); + if (val == null) + return defaultVal; + return Boolean.valueOf(val).booleanValue(); + } + + /** + * Default false + * @since 0.7.12 + */ + public boolean getBooleanProperty(String propName) { + return Boolean.valueOf(getProperty(propName)).booleanValue(); + } + + /** + * @since 0.7.12 + */ + public boolean getBooleanPropertyDefaultTrue(String propName) { + return getProperty(propName, true); + } + /** * Access the configuration attributes of this context, listing the properties * provided during the context construction, as well as the ones included in