From 33ef3c2fb81744ed3f21a64f30a818531f1dd7e9 Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 27 Mar 2014 09:01:28 -0400 Subject: [PATCH] Add a method to test for the existence of a setting --- src/main/java/com/gitblit/IStoredSettings.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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. -- 2.39.5