Skip to content

Instantly share code, notes, and snippets.

@kevinmeredith
Created April 14, 2018 16:40
Show Gist options
  • Select an option

  • Save kevinmeredith/80f8b66d11dc15d32a06ea3e67f1cc10 to your computer and use it in GitHub Desktop.

Select an option

Save kevinmeredith/80f8b66d11dc15d32a06ea3e67f1cc10 to your computer and use it in GitHub Desktop.

Revisions

  1. kevinmeredith created this gist Apr 14, 2018.
    19 changes: 19 additions & 0 deletions a.scala
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    import $ivy.`com.beachape::enumeratum-circe:1.5.17`

    import enumeratum._

    sealed trait Color extends EnumEntry; case object Color extends Enum[Color] with CirceEnum[Color] {

    case object Red extends Color
    case object Green extends Color
    case object Blue extends Color

    val values = findValues

    }

    @ val x: Color = Color.Red
    xx: Color = Red

    @ x.asJson
    res10: Json = JString("Red")