Просмотр исходного кода

Add hasOptionString and deprecate the public hasOption method (should be

made protected at a later stage)
tags/0.6.3m1rc1
Chris Smith 15 лет назад
Родитель
Сommit
41e6353563

+ 1
- 1
src/com/dmdirc/config/ConfigManager.java Просмотреть файл

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

+ 14
- 0
src/com/dmdirc/config/ConfigSource.java Просмотреть файл

52
      * @param domain The domain of the option
52
      * @param domain The domain of the option
53
      * @param option The name of the option
53
      * @param option The name of the option
54
      * @return True iff the option exists, false otherwise.
54
      * @return True iff the option exists, false otherwise.
55
+     * @deprecated Should only be used internally by ConfigSource
55
      */
56
      */
57
+    @Deprecated
56
     public abstract boolean hasOption(final String domain, final String option);
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
      * Determines if this manager has the specified integer option.
73
      * Determines if this manager has the specified integer option.
60
      *
74
      *

+ 1
- 1
src/com/dmdirc/config/Identity.java Просмотреть файл

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

+ 1
- 1
src/com/dmdirc/ui/themes/ThemeIdentity.java Просмотреть файл

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

+ 1
- 1
test/com/dmdirc/harness/TestConfigManagerMap.java Просмотреть файл

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

+ 1
- 1
test/com/dmdirc/harness/TestConfigManagerOptionToggle.java Просмотреть файл

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

+ 1
- 1
test/com/dmdirc/harness/TestConfigSource.java Просмотреть файл

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

Загрузка…
Отмена
Сохранить