diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/settings/config/ConfigWriter.java b/Plan/common/src/main/java/com/djrapitops/plan/system/settings/config/ConfigWriter.java index 4092b8ba6..1b6ceb0b8 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/settings/config/ConfigWriter.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/settings/config/ConfigWriter.java @@ -16,6 +16,8 @@ */ package com.djrapitops.plan.system.settings.config; +import com.djrapitops.plugin.utilities.Verify; + import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -37,14 +39,31 @@ public class ConfigWriter { private Path outputPath; private int indent; + /** + * Create a new ConfigWriter that doesn't write anywhere. + */ public ConfigWriter() { } + /** + * Create a new ConfigWriter that writes to a Path. + * + * @param outputPath Path to write to. + */ public ConfigWriter(Path outputPath) { this.outputPath = outputPath; } + /** + * Write a {@link ConfigNode} into the given resource. + * + * @param writing ConfigNode to write. + * @throws IOException If the Path given to constructor can not be written to. + * @throws IllegalStateException If the Path is null + */ public void write(ConfigNode writing) throws IOException { + Verify.nullCheck(outputPath, () -> new IllegalStateException("Output path was null.")); + ConfigNode storedParent = writing.parent; writing.updateParent(null); @@ -53,6 +72,14 @@ public class ConfigWriter { writing.updateParent(storedParent); } + /** + * Parse the lines of a {@link ConfigNode}. + *
+ * "Write" the lines into a List.
+ *
+ * @param writing ConfigNode to "write"
+ * @return List of lines that would be written.
+ */
public List