From: James Moger Date: Thu, 27 Mar 2014 13:01:28 +0000 (-0400) Subject: Add a method to test for the existence of a setting X-Git-Tag: v1.5.0~95 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=33ef3c2fb81744ed3f21a64f30a818531f1dd7e9;p=gitblit.git Add a method to test for the existence of a setting --- diff --git a/src/main/java/com/gitblit/IStoredSettings.java b/src/main/java/com/gitblit/IStoredSettings.java index 9c7a2d23..13dca6b6 100644 --- a/src/main/java/com/gitblit/IStoredSettings.java +++ b/src/main/java/com/gitblit/IStoredSettings.java @@ -342,6 +342,16 @@ public abstract class IStoredSettings { overrides.put(key, "" + value); } + /** + * Tests for the existence of a setting. + * + * @param key + * @return true if the setting exists + */ + public boolean hasSettings(String key) { + return getString(key, null) != null; + } + /** * Updates the values for the specified keys and persists the entire * configuration file.