Joshua Hansen
04/12/2023, 8:16 PMsealed class Function
which has a properties abstract val name: String
and abstract val params: List<Parameter<*>>
. Now, I also have sealed class Parameter<T>(private val value: T)
where T
can be a few kinds of primitives or a list.
My end goal is to have have an instance of the Function
class serialize as a string to a typical function header style: name(param1.value, param2.value, param3.value)
. A few questions here:
• How might I use the name (which is unique among Function
implementations) to dynamically deserialize the param list? Is this possible with a custom serializer?
• Can I do this with a single customer serializer? Or do I need one for each sublclass of Function
?
• Since Function
has a list of Parameters
, do I need a customer Serializer for List<Parameter<*>>
? Still not quite sure how this works.