This trait provides an instance of Writes
for an enumeration.
This trait provides an instance of Writes
for an enumeration. It works
by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends AsJson[Color]
This trait provides an instance of Reads
for an enumeration.
This trait provides an instance of Reads
for an enumeration. It works
by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends FromJson[Color]
If you need your Reads
instance to be case-insensitive you can override
the caseSensitive
member like so:
@enum class Color { Red Blue Yellow } object Color extends FromJson[Color] { override val caseSensitive = false }
This trait provides an instance of Reads
for an enumeration.
This trait provides an instance of Reads
for an enumeration. Unlike
FromJson
, the Reads
instance created by this trait operates on
JsNumber
using the Int
representation of the enumeration. It works
by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends FromJsonNumeric[Color]
Allows you to read JSON numbers as Color like so:
JsNumber(0).validate[Color] // JsResult(Red)
This trait provides an instance of Format
for an enumeration.
This trait provides an instance of Format
for an enumeration. It works
by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends JsonConverters[Color]
If you need your Format
instance to be case-insensitive you can override
the caseSensitive
member like so:
@enum class Color { Red Blue Yellow } object Color extends JsonConverters[Color] { override val caseSensitive = false }
This trait provides an instance of PathBindable
for an enumeration.
This trait provides an instance of PathBindable
for an enumeration.
It works by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends PathBindable[Color]
If you need your PathBindable
instance to be case-insensitive you can override
the caseSensitive
member like so:
@enum class Color { Red Blue Yellow } object Color extends PathConverters[Color] { override val caseSensitive = false }
This trait provides an instance of PathBindable
for an enumeration.
This trait provides an instance of PathBindable
for an enumeration.
Unlike PathConverters
, the PathBindable
instance created by
this trait treats the input as a number using the Int
representation of the
enumeration. It works by extending the companion object of the enumeration class.
@enum class Digit { Zero One Two Three Four Five Six Seven Eight Nine } object Digit extends PathNumericConverters[Digit]
This trait provides an instance of QueryStringBindable
for an enumeration.
This trait provides an instance of QueryStringBindable
for an enumeration.
It works by extending the companion object of the enumeration class.
@enum class Color { Red Blue Yellow } object Color extends QueryStringConverters[Color]
If you need your QueryStringBindable
instance to be case-insensitive you can override
the caseSensitive
member like so:
@enum class Color { Red Blue Yellow } object Color extends QueryStringConverters[Color] { override val caseSensitive = false }
This trait provides an instance of QueryStringBindable
for an enumeration.
This trait provides an instance of QueryStringBindable
for an enumeration.
Unlike QueryStringConverters
, the QueryStringBindable
instance created by
this trait treats the input as a number using the Int
representation of the
enumeration. It works by extending the companion object of the enumeration class.
@enum class Digit { Zero One Two Three Four Five Six Seven Eight Nine } object Digit extends QueryStringNumericConverters[Digit]