https://kotlinlang.org logo
Title
u

user

07/07/2022, 7:31 AM
Should I get rid of big switch case? I have a factory which includes many HTML attribute generators which returns one of them based on the type of attribute, so I wanted to see if there is a better way of doing this. class AttributeHtmlGeneratorFactory { fun create(property: String): AttributeHtmlGenerator { when (property) { "animation" -> { return AnimationHtmlGenerator() } ... "left", "top" -> { return PositionHtmlGenerator()...