Skip to content

Commit 06ed92a

Browse files
Rename new method to 'prune' and deprecate 'strip'
1 parent 849154b commit 06ed92a

File tree

8 files changed

+14
-12
lines changed

8 files changed

+14
-12
lines changed

core/src/main/java/io/github/almightysatan/jaskl/Config.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,24 @@ public interface Config {
6262

6363
/**
6464
* Cleans up dead entries from the storage location.
65-
* An entry is dead if no {@link ConfigEntry} references its path.
65+
* An entry is considered dead if no {@link ConfigEntry} references its path.
6666
*
6767
* @return a set containing all removed paths. Depending on the implementation map entries might be returned as
6868
* separate paths.
6969
* @throws IOException if an I/O exception occurs.
7070
*/
71-
@Unmodifiable @NotNull Set<@NotNull String> strip0() throws IOException; // stripPaths ?
71+
@Unmodifiable @NotNull Set<@NotNull String> prune() throws IOException;
7272

7373
/**
7474
* Cleans up dead entries from the storage location.
75-
* An entry is dead if no {@link ConfigEntry} references its path.
75+
* An entry is considered dead if no {@link ConfigEntry} references its path.
7676
*
7777
* @throws IOException if an I/O exception occurs.
78+
* @deprecated use {@link #prune()} instead
7879
*/
80+
@Deprecated
7981
default void strip() throws IOException {
80-
this.strip0();
82+
this.prune();
8183
}
8284

8385
/**

core/src/test/java/io/github/almightysatan/jaskl/test/NopConfigImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void write() {
4646
}
4747

4848
@Override
49-
public @Unmodifiable @NotNull Set<@NotNull String> strip0() {
49+
public @Unmodifiable @NotNull Set<@NotNull String> prune() {
5050
return Collections.emptySet();
5151
}
5252

core/src/testFixtures/java/io/github/almightysatan/jaskl/test/ConfigTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public static void testStrip(Supplier<Config> configSupplier, File file) throws
401401
ConfigEntry<String> stringConfigEntry1 = StringConfigEntry.of(config1, "example.string", "Example String", "default");
402402

403403
config1.load();
404-
Set<String> paths = config1.strip0();
404+
Set<String> paths = config1.prune();
405405
config1.close();
406406

407407
Config config2 = configSupplier.get();
@@ -454,7 +454,7 @@ public static void testStripMap(Supplier<Config> configSupplier, File file) thro
454454
MapConfigEntry.of(config1, "example.1.map1", null, map1New, Type.STRING, Type.STRING);
455455

456456
config1.load();
457-
Set<String> paths = config1.strip0();
457+
Set<String> paths = config1.prune();
458458
config1.close();
459459

460460
Config config2 = configSupplier.get();

hocon/src/main/java/io/github/almightysatan/jaskl/hocon/HoconConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void write() throws IOException {
104104
}
105105

106106
@Override
107-
public @Unmodifiable @NotNull Set<@NotNull String> strip0() throws IOException {
107+
public @Unmodifiable @NotNull Set<@NotNull String> prune() throws IOException {
108108
Config config = this.config;
109109
if (config == null)
110110
throw new IllegalStateException();

jackson/src/main/java/io/github/almightysatan/jaskl/jackson/JacksonConfigImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void write() throws IOException {
103103
}
104104

105105
@Override
106-
public @Unmodifiable @NotNull Set<@NotNull String> strip0() throws IOException {
106+
public @Unmodifiable @NotNull Set<@NotNull String> prune() throws IOException {
107107
if (this.root == null)
108108
throw new IllegalStateException();
109109
Util.createFileAndPath(this.file);

mongodb/src/main/java/io/github/almightysatan/jaskl/mongodb/MongodbConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public void write() throws IOException {
121121
}
122122

123123
@Override
124-
public @Unmodifiable @NotNull Set<@NotNull String> strip0() throws IOException {
124+
public @Unmodifiable @NotNull Set<@NotNull String> prune() throws IOException {
125125
if (this.mongoCollection == null)
126126
throw new IllegalStateException();
127127

properties/src/main/java/io/github/almightysatan/jaskl/properties/PropertiesConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void write() throws IOException {
8686
}
8787

8888
@Override
89-
public @Unmodifiable @NotNull Set<@NotNull String> strip0() throws IOException {
89+
public @Unmodifiable @NotNull Set<@NotNull String> prune() throws IOException {
9090
if (this.config == null)
9191
throw new IllegalStateException();
9292
Util.createFileAndPath(this.file);

yaml/src/main/java/io/github/almightysatan/jaskl/yaml/YamlConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void write() throws IOException {
109109
}
110110

111111
@Override
112-
public @Unmodifiable @NotNull Set<@NotNull String> strip0() throws IOException {
112+
public @Unmodifiable @NotNull Set<@NotNull String> prune() throws IOException {
113113
if (this.yaml == null)
114114
throw new IllegalStateException();
115115
Util.createFileAndPath(this.file);

0 commit comments

Comments
 (0)