Browse Source

Add hasOptionString and deprecate the public hasOption method (should be

made protected at a later stage)
tags/0.6.3m1rc1
Chris Smith 15 years ago
parent
commit
41e6353563

+ 1
- 1
src/com/dmdirc/config/ConfigManager.java View File

@@ -123,7 +123,7 @@ public class ConfigManager extends ConfigSource implements Serializable,
123 123
     }
124 124
 
125 125
     /** {@inheritDoc} */
126
-    @Override
126
+    @Override @Deprecated
127 127
     public boolean hasOption(final String domain, final String option) {
128 128
         doStats(domain, option);
129 129
 

+ 14
- 0
src/com/dmdirc/config/ConfigSource.java View File

@@ -52,9 +52,23 @@ public abstract class ConfigSource {
52 52
      * @param domain The domain of the option
53 53
      * @param option The name of the option
54 54
      * @return True iff the option exists, false otherwise.
55
+     * @deprecated Should only be used internally by ConfigSource
55 56
      */
57
+    @Deprecated
56 58
     public abstract boolean hasOption(final String domain, final String option);
57 59
 
60
+    /**
61
+     * Determines if this manager has the specified String option.
62
+     *
63
+     * @param domain The domain of the option
64
+     * @param option The name of the option
65
+     * @since 0.6.3
66
+     * @return True iff the option exists and is not empty, false otherwise
67
+     */
68
+    public boolean hasOptionString(final String domain, final String option) {
69
+        return hasOption(domain, option) && !getOption(domain, option).isEmpty();
70
+    }
71
+
58 72
     /**
59 73
      * Determines if this manager has the specified integer option.
60 74
      *

+ 1
- 1
src/com/dmdirc/config/Identity.java View File

@@ -307,7 +307,7 @@ public class Identity extends ConfigSource implements Serializable,
307 307
     }
308 308
 
309 309
     /** {@inheritDoc} */
310
-    @Override
310
+    @Override @Deprecated
311 311
     public boolean hasOption(final String domain, final String option) {
312 312
         return file.isKeyDomain(domain) && file.getKeyDomain(domain).containsKey(option);
313 313
     }

+ 1
- 1
src/com/dmdirc/ui/themes/ThemeIdentity.java View File

@@ -63,7 +63,7 @@ public class ThemeIdentity extends Identity {
63 63
     }
64 64
     
65 65
     /** {@inheritDoc} */
66
-    @Override
66
+    @Override @Deprecated
67 67
     public boolean hasOption(final String domain, final String option) {
68 68
         if (domain.equalsIgnoreCase("ui") || domain.equalsIgnoreCase("identity")
69 69
                 || domain.equalsIgnoreCase("icon")  || domain.equalsIgnoreCase("theme")

+ 1
- 1
test/com/dmdirc/harness/TestConfigManagerMap.java View File

@@ -44,7 +44,7 @@ public class TestConfigManagerMap extends ConfigManager {
44 44
         }
45 45
     }
46 46
 
47
-    @Override
47
+    @Override @Deprecated
48 48
     public boolean hasOption(String domain, String option) {
49 49
         if (settings.containsKey(domain + "." + option)) {
50 50
             return true;

+ 1
- 1
test/com/dmdirc/harness/TestConfigManagerOptionToggle.java View File

@@ -35,7 +35,7 @@ public class TestConfigManagerOptionToggle extends ConfigManager {
35 35
         return option.substring(1);
36 36
     }
37 37
 
38
-    @Override
38
+    @Override @Deprecated
39 39
     public boolean hasOption(String domain, String option) {
40 40
         return option.charAt(0) == '1';
41 41
     }

+ 1
- 1
test/com/dmdirc/harness/TestConfigSource.java View File

@@ -31,7 +31,7 @@ public class TestConfigSource extends ConfigSource {
31 31
         return option;
32 32
     }
33 33
 
34
-    @Override
34
+    @Override @Deprecated
35 35
     public boolean hasOption(String domain, String option) {
36 36
         return Boolean.parseBoolean(domain);
37 37
     }

Loading…
Cancel
Save