enumeratum

package enumeratum

Members list

Concise view

Type members

Classlikes

trait Enum[A <: EnumEntry]

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.

Example:

scala> import enumeratum._

scala> sealed trait DummyEnum extends EnumEntry

scala> object DummyEnum extends Enum[DummyEnum] {
   |   val values = findValues
   |   case object Hello   extends DummyEnum
   |   case object GoodBye extends DummyEnum
   |   case object Hi      extends DummyEnum
   | }

scala> DummyEnum.withNameOption("Hello")
res0: Option[DummyEnum] = Some(Hello)

scala> DummyEnum.withNameOption("Nope")
res1: Option[DummyEnum] = None

Attributes

A

The sealed trait

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
object Enum

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Enum.type
trait EnumEntry

Base type for an enum entry for Enum

Base type for an enum entry for Enum

By default, the entryName method used for serialising and deserialising Enum values uses toString, but feel free to override to fit your needs.

Mix in the supplied stackable traits to convert the entryName to Snakecase, Uppercase, Lowercase etc.

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object EnumEntry

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
final case class NoSuchMember[A <: EnumEntry](notFoundName: String, enumValues: IndexedSeq[A]) extends NoSuchElementException with NoStackTrace

Attributes

Graph
Supertypes
trait Product
trait Equals
trait NoStackTrace
class NoSuchElementException
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any