From 2159b8d6cc7e0de418062fecb8e57244184e8820 Mon Sep 17 00:00:00 2001 From: nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> Date: Mon, 25 Jul 2022 11:58:48 +0100 Subject: additional config migrators (#64) * json migrator * *coughs* * casting issues fix * cfg implementation and a couple fixes * reformat * cast fix + javadoc * make the json migrator useful, double parsing, separate annotations --- api/OneConfig.api | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'api') diff --git a/api/OneConfig.api b/api/OneConfig.api index b7ecd78..c9c7ae3 100644 --- a/api/OneConfig.api +++ b/api/OneConfig.api @@ -338,6 +338,33 @@ public class cc/polyfrost/oneconfig/config/gson/ProfileExclusionStrategy : cc/po public fun shouldSkipField (Lcom/google/gson/FieldAttributes;)Z } +public class cc/polyfrost/oneconfig/config/migration/CfgMigrator : cc/polyfrost/oneconfig/config/migration/Migrator { + public fun (Ljava/lang/String;)V + protected fun generateValues ()V + public fun getValue (Ljava/lang/reflect/Field;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object; + protected fun parse (Ljava/lang/String;)Ljava/lang/String; +} + +public abstract interface annotation class cc/polyfrost/oneconfig/config/migration/CfgName : java/lang/annotation/Annotation { + public abstract fun category ()Ljava/lang/String; + public abstract fun name ()Ljava/lang/String; +} + +public class cc/polyfrost/oneconfig/config/migration/JsonMigrator : cc/polyfrost/oneconfig/config/migration/Migrator { + protected field object Lcom/google/gson/JsonObject; + protected field values Ljava/util/HashMap; + public fun (Ljava/lang/String;)V + protected fun generateValues ()V + public fun getValue (Ljava/lang/reflect/Field;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object; + protected fun loopThroughChildren (Ljava/lang/String;Lcom/google/gson/JsonObject;)V + protected fun parse (Ljava/lang/String;)Ljava/lang/String; + protected fun put (Ljava/lang/String;Lcom/google/gson/JsonElement;)V +} + +public abstract interface annotation class cc/polyfrost/oneconfig/config/migration/JsonName : java/lang/annotation/Annotation { + public abstract fun value ()Ljava/lang/String; +} + public abstract interface class cc/polyfrost/oneconfig/config/migration/Migrator { public abstract fun getValue (Ljava/lang/reflect/Field;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object; } @@ -347,7 +374,7 @@ public class cc/polyfrost/oneconfig/config/migration/VigilanceMigrator : cc/poly protected final field filePath Ljava/lang/String; protected field values Ljava/util/HashMap; public fun (Ljava/lang/String;)V - protected fun getOptions ()V + protected fun generateValues ()V public fun getValue (Ljava/lang/reflect/Field;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object; protected fun parse (Ljava/lang/String;)Ljava/lang/String; } -- cgit