enumeratum

package enumeratum

Visibility
  1. Public
  2. All

Type Members

  1. trait Enum[A] extends AnyRef

    All the cool kids have their own Enumeration implementation, most of which try to do so in the name of implementing exhaustive pattern matching.

    All the cool kids have their own Enumeration implementation, most of which try to do so in the name of implementing exhaustive pattern matching.

    This is yet another one.

    Oh yeah, Enum is BYOO (bring your own ordinality). Take care of that when you implement the value method.

    How to use:

    sealed trait DummyEnum
    
    object DummyEnum extends Enum[DummyEnum] {
    
    val values = findValues.toIndexedSeq
    
    case object Hello extends DummyEnum
    case object GoodBye extends DummyEnum
    case object Hi extends DummyEnum
    
    }
    
    
    DummyEnum.values should be(Set(Hello, GoodBye, Hi))
    
    DummyEnum.withName("Hello") should be(Hello)
    A

    The sealed trait you want to use as the main

Ungrouped