Keeping it simple, wrap the value in a case class, for example:
case class EnumLike(value: String)
object EnumLike {
final val One = EnumLike("One")
final val Two = EnumLike("Two")
final val Three = EnumLike("Three")
}
- simple
- works as expected also with pattern matching
- wrapper is creating an overhead over the primitive value (impacting the performance)
- you can't actually separate logic for different cases, since there is only one main class