Refactor ObjectInfoData to Kotlin

This commit is contained in:
Wieland Schöbl
2021-04-12 15:38:56 +02:00
parent 2304261a62
commit c8c1d2ebbb
3 changed files with 8 additions and 17 deletions

View File

@@ -1,16 +0,0 @@
package org.hmcore.registration.config;
import org.jetbrains.annotations.Nullable;
public class ObjectInfoData {
public final String objectName;
public final String objectInfoChosen;
public final String _availableOptions;
public ObjectInfoData(String objectName, @Nullable String objectInfoChosen, String availableOptions) {
this.objectName = objectName;
this.objectInfoChosen = objectInfoChosen == null ? "default" : objectInfoChosen;
_availableOptions = availableOptions;
}
}

View File

@@ -8,5 +8,5 @@ import extensions.map
private val GSON = GsonBuilder().setPrettyPrinting().create()
fun Array<Module<*, *>>.generateFreshJSON(): String =
internal fun Array<Module<*, *>>.generateFreshJSON(): String =
GSON.toJson(ObjectInfoConfig(map { ModuleInfo(it.name, it.objectInfoArray) }))

View File

@@ -0,0 +1,7 @@
package org.hmcore.registration.config
internal class ObjectInfoData @JvmOverloads constructor(
@JvmField val objectInfoName: String,
@JvmField val availableOptions: String,
@JvmField val objectInfoChosen: String = "default",
)