1 2 3 4 5 6 7 8 9 10 11
sealed trait EthernetType object EthernetType { final case object Gigabit extends EthernetType final case object FastEthernet extends EthernetType final def toInt(t: EthernetType) = t match { case Gigabit => 1 case FastEthernet => 2 } }