enumeratum
package enumeratum
Members list
Packages
package enumeratum.values
Type members
Classlikes
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
Type parameters
- A
-
The sealed trait
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
object Enum
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
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait Camelcasetrait LowerCamelcasetrait CapitalDotcasetrait Dotcasetrait UpperDotcasetrait CapitalHyphencasetrait Hyphencasetrait UpperHyphencasetrait CapitalSnakecasetrait Snakecasetrait UpperSnakecasetrait CapitalWordstrait UpperWordstrait Wordstrait Lowercasetrait Uncapitalisedtrait UppercaseShow all
object EnumEntry
final case class NoSuchMember[A <: EnumEntry](notFoundName: String, enumValues: IndexedSeq[A]) extends NoSuchElementException, NoStackTrace
Attributes
- Supertypes
-
trait Producttrait Equalstrait NoStackTraceclass NoSuchElementExceptionclass RuntimeExceptionclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
In this article