Skip to content

Commit ae3bc6d

Browse files
committed
Rename NodeLoadCallback to NodeValueCallback to extend it potential use case
1 parent b1d1263 commit ae3bc6d

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

src/main/java/org/mvplugins/multiverse/core/config/node/ConfigNode.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.jetbrains.annotations.Nullable;
1616

1717
import org.mvplugins.multiverse.core.config.node.functions.NodeChangeCallback;
18-
import org.mvplugins.multiverse.core.config.node.functions.NodeLoadCallback;
18+
import org.mvplugins.multiverse.core.config.node.functions.NodeValueCallback;
1919
import org.mvplugins.multiverse.core.config.node.functions.SenderNodeChangeCallback;
2020
import org.mvplugins.multiverse.core.config.node.functions.SenderNodeStringParser;
2121
import org.mvplugins.multiverse.core.config.node.functions.SenderNodeSuggester;
@@ -56,7 +56,7 @@ public class ConfigNode<T> extends ConfigHeaderNode implements ValueNode<T> {
5656
protected @Nullable NodeStringParser<T> stringParser;
5757
protected @Nullable NodeSerializer<T> serializer;
5858
protected @Nullable Function<T, Try<Void>> validator;
59-
protected @Nullable NodeLoadCallback<T> onLoad;
59+
protected @Nullable NodeValueCallback<T> onLoad;
6060
protected @Nullable NodeChangeCallback<T> onLoadAndChange;
6161
protected @Nullable NodeChangeCallback<T> onChange;
6262

@@ -71,7 +71,7 @@ protected ConfigNode(
7171
@Nullable NodeStringParser<T> stringParser,
7272
@Nullable NodeSerializer<T> serializer,
7373
@Nullable Function<T, Try<Void>> validator,
74-
@Nullable NodeLoadCallback<T> onLoad,
74+
@Nullable NodeValueCallback<T> onLoad,
7575
@Nullable NodeChangeCallback<T> onLoadAndChange,
7676
@Nullable NodeChangeCallback<T> onChange) {
7777
super(path, comments);
@@ -237,7 +237,7 @@ public static class Builder<T, B extends ConfigNode.Builder<T, B>> extends Confi
237237
protected @Nullable NodeStringParser<T> stringParser;
238238
protected @Nullable NodeSerializer<T> serializer;
239239
protected @Nullable Function<T, Try<Void>> validator;
240-
protected @Nullable NodeLoadCallback<T> onLoad;
240+
protected @Nullable NodeValueCallback<T> onLoad;
241241
protected @Nullable NodeChangeCallback<T> onLoadAndChange;
242242
protected @Nullable NodeChangeCallback<T> onChange;
243243

@@ -406,7 +406,7 @@ protected Builder(@NotNull String path, @NotNull Class<T> type) {
406406
* @return This builder.
407407
*/
408408
@ApiStatus.AvailableSince("5.4")
409-
public @NotNull B onLoad(@NotNull NodeLoadCallback<T> onLoad) {
409+
public @NotNull B onLoad(@NotNull NodeValueCallback<T> onLoad) {
410410
this.onLoad = this.onLoad == null ? onLoad : this.onLoad.then(onLoad);
411411
return self();
412412
}

src/main/java/org/mvplugins/multiverse/core/config/node/ListConfigNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import org.mvplugins.multiverse.core.config.node.functions.DefaultStringParserProvider;
2121
import org.mvplugins.multiverse.core.config.node.functions.DefaultSuggesterProvider;
2222
import org.mvplugins.multiverse.core.config.node.functions.NodeChangeCallback;
23-
import org.mvplugins.multiverse.core.config.node.functions.NodeLoadCallback;
23+
import org.mvplugins.multiverse.core.config.node.functions.NodeValueCallback;
2424
import org.mvplugins.multiverse.core.config.node.functions.NodeStringParser;
2525
import org.mvplugins.multiverse.core.config.node.functions.NodeSuggester;
2626
import org.mvplugins.multiverse.core.config.node.functions.SenderNodeStringParser;
@@ -69,7 +69,7 @@ protected ListConfigNode(
6969
@Nullable NodeStringParser<List<I>> stringParser,
7070
@Nullable NodeSerializer<List<I>> serializer,
7171
@Nullable Function<List<I>, Try<Void>> validator,
72-
@Nullable NodeLoadCallback<List<I>> onLoad,
72+
@Nullable NodeValueCallback<List<I>> onLoad,
7373
@Nullable NodeChangeCallback<List<I>> onLoadAndChange,
7474
@Nullable NodeChangeCallback<List<I>> onChange,
7575
@NotNull Class<I> itemType,

src/main/java/org/mvplugins/multiverse/core/config/node/functions/NodeLoadCallback.java renamed to src/main/java/org/mvplugins/multiverse/core/config/node/functions/NodeValueCallback.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
11
package org.mvplugins.multiverse.core.config.node.functions;
22

33
import org.jetbrains.annotations.ApiStatus;
4-
import org.mvplugins.multiverse.core.config.node.ConfigNode;
54

65
/**
7-
* Handler called when a node's value is loaded. See {@link ConfigNode#onLoad(Object)}.
6+
* Handler called when an action is performed on a node such as loading.
87
*
98
* @since 5.4
109
*/
1110
@ApiStatus.AvailableSince("5.4")
1211
@FunctionalInterface
13-
public interface NodeLoadCallback<T> {
12+
public interface NodeValueCallback<T> {
1413
/**
15-
* Called when the value of a node is loaded.
14+
* Called when an action is performed on a node.
1615
*
17-
* @param value The loaded value of the node.
16+
* @param value The value of the node.
1817
*
1918
* @since 5.4
2019
*/
2120
@ApiStatus.AvailableSince("5.4")
2221
void run(T value);
2322

2423
/**
25-
* Chains another {@link NodeLoadCallback} to be executed after this one.
24+
* Chains another {@link NodeValueCallback} to be executed after this one.
2625
*
2726
* @param after The callback to execute after this one.
28-
* @return A new {@link NodeLoadCallback} that executes both callbacks in order.
27+
* @return A new {@link NodeValueCallback} that executes both callbacks in order.
2928
*
3029
* @since 5.4
3130
*/
3231
@ApiStatus.AvailableSince("5.4")
33-
default NodeLoadCallback<T> then(NodeLoadCallback<T> after) {
32+
default NodeValueCallback<T> then(NodeValueCallback<T> after) {
3433
return (T value) -> {
3534
this.run(value);
3635
after.run(value);

0 commit comments

Comments
 (0)