Skip to content

Commit 25ce153

Browse files
committed
PrefService: deprecate clear(Class, String)
This is the same thing as remove(Class, String). Actually, in the Preferences API, clear and removeNode are not the same: removeNode is recursive, whereas clear just clears keys at the current node and not below. But the latter non-recursive behavior is not something we want to expose via the PrefService API.
1 parent 4fee211 commit 25ce153

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,6 @@ public void clearAll() {
165165
prefs(name).removeNode();
166166
}
167167

168-
@Override
169-
public void clear(final Class<?> c, final String name) {
170-
prefs(c).clear(name);
171-
}
172-
173168
@Override
174169
public void remove(final Class<?> c, final String name) {
175170
prefs(c).remove(name);
@@ -297,6 +292,12 @@ public void putIterable(final Iterable<String> iterable, final String key) {
297292
putIterable((Class<?>) null, iterable, key);
298293
}
299294

295+
@Deprecated
296+
@Override
297+
public void clear(final Class<?> c, final String name) {
298+
prefs(c).clear(name);
299+
}
300+
300301
// -- Helper methods --
301302

302303
private SmartPrefs prefs(final Class<?> c) {

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ default String get(final Class<?> c, final String name) {
8686
/** Clears everything. */
8787
void clearAll();
8888

89-
/**
90-
* Clears the node indexed under the given class.
91-
*/
92-
void clear(Class<?> c, String name);
93-
9489
/** Removes the node. */
9590
void remove(Class<?> c, String name);
9691

@@ -264,4 +259,7 @@ default void clear(final String key) {
264259

265260
@Deprecated
266261
Iterable<String> getIterable(String key);
262+
263+
@Deprecated
264+
void clear(Class<?> c, String name);
267265
}

0 commit comments

Comments
 (0)