I can't use your solution Adam because I will maybe have other values that sets the first one
My application is for creating JSON from templates, but there are types of JSONs and type of these types, like
Recipe
type and
Texture
type, and for recipes there is
CraftingShapedRecipeTemplate
and
CraftingShapelessRecipeTemplate()
and
SmeltingRecipeTemplate()
etc, same for
Texture
, there are multiple types
But I have 1 box that contains the fields the user have to complete for the template, like
name
,
id
etc, there are a lot of different fields through the templates
So to know what template I have, I have multiple Enums, like
RecipeType
and
TextureType
, and for each enum I have a function
toTemplate()
which transform itself into the template
So for now when my second value changes, I set the first one to the Enum name and in the box I get back the template by searching through all the Enum if in any I can find a Enum value matching, using
MyEnum.values().find { it.name == firstValue } ?: MyOtherEnum.Values().find { it.name == firstValue } etc
and then I execute
.toTemplate()
or I return if null
I don't know if it is a good architecture but I thought of this