From c9af5326d10acb458ae7fb2e2d77504543d26913 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 29 Apr 2021 10:13:46 +0200 Subject: [PATCH] Add ConfigConverter --- .../configplayer/ConfigConverter.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/configplayer/ConfigConverter.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/configplayer/ConfigConverter.java b/BauSystem_Main/src/de/steamwar/bausystem/configplayer/ConfigConverter.java new file mode 100644 index 00000000..29b6314c --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/configplayer/ConfigConverter.java @@ -0,0 +1,29 @@ +package de.steamwar.bausystem.configplayer; + +import yapion.hierarchy.types.YAPIONObject; + +public interface ConfigConverter { + + /** + * This describes the version this Converter can convert from. The version + * it should convert to is the version 1 above this number. But this is not + * a necessity. In the config Object as parameter given in {@link #update(YAPIONObject)} + * you should update the @version variable in the root object to the + * new version this converter produced. + * + * @return the version number + */ + int version(); + + /** + * This method should update everything needed to go from a lower config + * version to a higher. It should update the @version variable + * accordingly. Anything else is up the implementation. If anything goes wrong + * do not silently exit this method, throw an Exception. The updater Code will + * deal with it. Never leave the inputted object in a corrupted state. + * + * @param config the config object to update + */ + void update(YAPIONObject config); + +}