Skip to content

Commit 5f30326

Browse files
committed
PrefService: deprecate global preferences
Best to always give a class.
1 parent 13e4ec3 commit 5f30326

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

src/main/java/org/scijava/prefs/DefaultPrefService.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,66 +60,79 @@ public class DefaultPrefService extends AbstractPrefService {
6060

6161
// -- Global preferences --
6262

63+
@Deprecated
6364
@Override
6465
public String get(final String name) {
6566
return get((Class<?>) null, name);
6667
}
6768

69+
@Deprecated
6870
@Override
6971
public String get(final String name, final String defaultValue) {
7072
return get(null, name, defaultValue);
7173
}
7274

75+
@Deprecated
7376
@Override
7477
public boolean getBoolean(final String name, final boolean defaultValue) {
7578
return getBoolean(null, name, defaultValue);
7679
}
7780

81+
@Deprecated
7882
@Override
7983
public double getDouble(final String name, final double defaultValue) {
8084
return getDouble(null, name, defaultValue);
8185
}
8286

87+
@Deprecated
8388
@Override
8489
public float getFloat(final String name, final float defaultValue) {
8590
return getFloat(null, name, defaultValue);
8691
}
8792

93+
@Deprecated
8894
@Override
8995
public int getInt(final String name, final int defaultValue) {
9096
return getInt(null, name, defaultValue);
9197
}
9298

99+
@Deprecated
93100
@Override
94101
public long getLong(final String name, final long defaultValue) {
95102
return getLong(null, name, defaultValue);
96103
}
97104

105+
@Deprecated
98106
@Override
99107
public void put(final String name, final String value) {
100108
put(null, name, value);
101109
}
102110

111+
@Deprecated
103112
@Override
104113
public void put(final String name, final boolean value) {
105114
put(null, name, value);
106115
}
107116

117+
@Deprecated
108118
@Override
109119
public void put(final String name, final double value) {
110120
put(null, name, value);
111121
}
112122

123+
@Deprecated
113124
@Override
114125
public void put(final String name, final float value) {
115126
put(null, name, value);
116127
}
117128

129+
@Deprecated
118130
@Override
119131
public void put(final String name, final int value) {
120132
put(null, name, value);
121133
}
122134

135+
@Deprecated
123136
@Override
124137
public void put(final String name, final long value) {
125138
put(null, name, value);
@@ -220,6 +233,7 @@ public void clearAll() {
220233
prefs(name).removeNode();
221234
}
222235

236+
@Deprecated
223237
@Override
224238
public void clear(final String key) {
225239
clear((Class<?>) null, key);
@@ -230,6 +244,7 @@ public void clear(final Class<?> prefClass, final String key) {
230244
prefs(prefClass).clear(key);
231245
}
232246

247+
@Deprecated
233248
@Override
234249
public void clear(final String absolutePath, final String key) {
235250
prefs(absolutePath).clear(key);
@@ -240,11 +255,13 @@ public void remove(final Class<?> prefClass, final String key) {
240255
prefs(prefClass).remove(key);
241256
}
242257

258+
@Deprecated
243259
@Override
244260
public void remove(final String absolutePath, final String key) {
245261
prefs(absolutePath).remove(key);
246262
}
247263

264+
@Deprecated
248265
@Override
249266
public void putMap(final Map<String, String> map, final String key) {
250267
putMap((Class<?>) null, map, key);
@@ -257,6 +274,7 @@ public void putMap(final Class<?> prefClass, final Map<String, String> map,
257274
prefs(prefClass).node(key).putMap(map);
258275
}
259276

277+
@Deprecated
260278
@Override
261279
public void putMap(final String absolutePath, final Map<String, String> map,
262280
final String key)
@@ -269,11 +287,13 @@ public void putMap(final Class<?> prefClass, final Map<String, String> map) {
269287
prefs(prefClass).putMap(map);
270288
}
271289

290+
@Deprecated
272291
@Override
273292
public void putMap(final String absolutePath, final Map<String, String> map) {
274293
prefs(absolutePath).putMap(map);
275294
}
276295

296+
@Deprecated
277297
@Override
278298
public Map<String, String> getMap(final String key) {
279299
return getMap((Class<?>) null, key);
@@ -285,6 +305,7 @@ public Map<String, String> getMap(final Class<?> prefClass, final String key)
285305
return prefs(prefClass).node(key).getMap();
286306
}
287307

308+
@Deprecated
288309
@Override
289310
public Map<String, String>
290311
getMap(final String absolutePath, final String key)
@@ -297,6 +318,7 @@ public Map<String, String> getMap(final Class<?> prefClass) {
297318
return prefs(prefClass).getMap();
298319
}
299320

321+
@Deprecated
300322
@Override
301323
public void putList(final List<String> list, final String key) {
302324
putList((Class<?>) null, list, key);
@@ -309,6 +331,7 @@ public void putList(final Class<?> prefClass, final List<String> list,
309331
prefs(prefClass).node(key).putList(list);
310332
}
311333

334+
@Deprecated
312335
@Override
313336
public void putList(final String absolutePath, final List<String> list,
314337
final String key)
@@ -321,11 +344,13 @@ public void putList(final Class<?> prefClass, final List<String> list) {
321344
prefs(prefClass).putList(list);
322345
}
323346

347+
@Deprecated
324348
@Override
325349
public void putList(final String absolutePath, final List<String> list) {
326350
prefs(absolutePath).putList(list);
327351
}
328352

353+
@Deprecated
329354
@Override
330355
public List<String> getList(final String key) {
331356
return getList((Class<?>) null, key);
@@ -336,6 +361,7 @@ public List<String> getList(final Class<?> prefClass, final String key) {
336361
return prefs(prefClass).node(key).getList();
337362
}
338363

364+
@Deprecated
339365
@Override
340366
public List<String> getList(final String absolutePath, final String key) {
341367
return prefs(absolutePath).node(key).getList();
@@ -346,6 +372,7 @@ public List<String> getList(final Class<?> prefClass) {
346372
return prefs(prefClass).getList();
347373
}
348374

375+
@Deprecated
349376
@Override
350377
public Iterable<String> getIterable(final String key) {
351378
return getIterable((Class<?>) null, key);
@@ -356,6 +383,7 @@ public Iterable<String> getIterable(final Class<?> prefClass, final String key)
356383
return prefs(prefClass).node(key).getIterable();
357384
}
358385

386+
@Deprecated
359387
@Override
360388
public void putIterable(final Iterable<String> iterable, final String key) {
361389
putIterable((Class<?>) null, iterable, key);

src/main/java/org/scijava/prefs/PrefService.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,43 @@
4545
*/
4646
public interface PrefService extends SciJavaService {
4747

48+
@Deprecated
4849
String get(String name);
4950

51+
@Deprecated
5052
String get(String name, String defaultValue);
5153

54+
@Deprecated
5255
boolean getBoolean(String name, boolean defaultValue);
5356

57+
@Deprecated
5458
double getDouble(String name, double defaultValue);
5559

60+
@Deprecated
5661
float getFloat(String name, float defaultValue);
5762

63+
@Deprecated
5864
int getInt(String name, int defaultValue);
5965

66+
@Deprecated
6067
long getLong(String name, long defaultValue);
6168

69+
@Deprecated
6270
void put(String name, String value);
6371

72+
@Deprecated
6473
void put(String name, boolean value);
6574

75+
@Deprecated
6676
void put(String name, double value);
6777

78+
@Deprecated
6879
void put(String name, float value);
6980

81+
@Deprecated
7082
void put(String name, int value);
7183

84+
@Deprecated
7285
void put(String name, long value);
7386

7487
String get(Class<?> c, String name);
@@ -103,6 +116,7 @@ public interface PrefService extends SciJavaService {
103116
void clearAll();
104117

105118
/** Clears the node. */
119+
@Deprecated
106120
void clear(String key);
107121

108122
/**
@@ -113,14 +127,17 @@ public interface PrefService extends SciJavaService {
113127
/**
114128
* Clears the ndoe indexed under the given path.
115129
*/
130+
@Deprecated
116131
void clear(String absolutePath, String key);
117132

118133
/** Removes the node. */
119134
void remove(Class<?> prefClass, String key);
120135

136+
@Deprecated
121137
void remove(String absolutePath, String key);
122138

123139
/** Puts a Map into the preferences. */
140+
@Deprecated
124141
void putMap(Map<String, String> map, String key);
125142

126143
/**
@@ -131,6 +148,7 @@ public interface PrefService extends SciJavaService {
131148
/**
132149
* Puts a Map into the preferences, indexed under the given path.
133150
*/
151+
@Deprecated
134152
void putMap(String absolutePath, Map<String, String> map);
135153

136154
/**
@@ -142,9 +160,11 @@ public interface PrefService extends SciJavaService {
142160
* Puts a Map into the preferences, indexed under the given path and
143161
* relative key path.
144162
*/
163+
@Deprecated
145164
void putMap(String absolutePath, Map<String, String> map, String key);
146165

147166
/** Gets a Map from the preferences. */
167+
@Deprecated
148168
Map<String, String> getMap(String key);
149169

150170
/**
@@ -155,9 +175,11 @@ public interface PrefService extends SciJavaService {
155175
/** Gets a Map from the preferences. */
156176
Map<String, String> getMap(Class<?> prefClass);
157177

178+
@Deprecated
158179
Map<String, String> getMap(String absolutePath, String key);
159180

160181
/** Puts a list into the preferences. */
182+
@Deprecated
161183
void putList(List<String> list, String key);
162184

163185
/**
@@ -169,20 +191,24 @@ public interface PrefService extends SciJavaService {
169191
* Puts a list into the preferences, indexed under the specified path and
170192
* relative key.
171193
*/
194+
@Deprecated
172195
void putList(String absolutePath, List<String> list, String key);
173196

174197
/** Puts a list into the preferences. */
175198
void putList(Class<?> prefClass, List<String> list);
176199

177200
/** Puts a list into the preferences, indexed under the specified path. */
201+
@Deprecated
178202
void putList(String absolutePath, List<String> list);
179203

180204
/** Gets a List from the preferences. */
205+
@Deprecated
181206
List<String> getList(String key);
182207

183208
/**
184209
* Gets a List from the preferences, indexed under the specified path.
185210
*/
211+
@Deprecated
186212
List<String> getList(String absolutePath, String key);
187213

188214
/**
@@ -199,6 +225,7 @@ public interface PrefService extends SciJavaService {
199225
/**
200226
* Puts an iterable into the preferences.
201227
*/
228+
@Deprecated
202229
void putIterable(Iterable<String> iterable, String key);
203230

204231
/**
@@ -209,6 +236,7 @@ public interface PrefService extends SciJavaService {
209236
/**
210237
* Gets an iterable from the preferences.
211238
*/
239+
@Deprecated
212240
Iterable<String> getIterable(String key);
213241

214242
/**

0 commit comments

Comments
 (0)