Skip to content

Commit cc97d1b

Browse files
committed
Mark saveValue and loadValue deprecated
ModuleItem#saveValue and ModuleItem#loadValue are now deprecated in favor of ModuleService methods, which can be called from a Contextual environment and thus use the new PrefService API.
1 parent 992f0b8 commit cc97d1b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/main/java/org/scijava/module/AbstractModuleItem.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ public String getPersistKey() {
137137
* value for null.
138138
*/
139139
@Override
140+
@Deprecated
140141
public T loadValue() {
141142
// if there is nothing to load from persistence return nothing
142143
if (!isPersisted()) return null;
@@ -157,6 +158,7 @@ public T loadValue() {
157158
}
158159

159160
@Override
161+
@Deprecated
160162
public void saveValue(final T value) {
161163
if (!isPersisted()) return;
162164

src/main/java/org/scijava/module/ModuleItem.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,21 @@ public interface ModuleItem<T> extends BasicDetails {
9393
* Note that this is different than obtaining a module instance's current
9494
* value for the input; see {@link #getValue(Module)} for that.
9595
* </p>
96+
*
97+
* @deprecated
98+
* @see ModuleService#load(ModuleItem)
9699
*/
100+
@Deprecated
97101
T loadValue();
98102

99103
/**
100104
* Saves the given value to persistent storage. This allows later restoration
101105
* of the value via {@link #loadValue()}, even from a different JVM.
106+
*
107+
* @deprecated
108+
* @see ModuleService#save(ModuleItem, Object)
102109
*/
110+
@Deprecated
103111
void saveValue(T value);
104112

105113
/** Gets the function that is called to initialize the item's value. */

0 commit comments

Comments
 (0)