CreateDerivedEnumerationCodec
class CreateDerivedEnumerationCodec[L, T](validator: Enumeration[T], schemaAnnotations: SchemaAnnotations[T])
class Object
trait Matchable
class Any
Value members
Constructors
Concrete methods
def apply(decode: L => Option[T], encode: T => L, default: Option[T])(implicit baseCodec: PlainCodec[L]): PlainCodec[T]
Creates the codec using the provided decoding & encoding functions.
Creates the codec using the provided decoding & encoding functions.
- Value parameters:
- decode
How low-level values are decoded to the enum value.
None
if the low-level value is invalid, that is, when there's no high-level enum value.- encode
How the enum value is encoded as a low-level value.
Creates the codec assuming the low-level representation is a String
. The encoding function uses the enum's .toString
. Similarly,
the decoding function performs a case-insensitive search using the enum's .toString
Creates the codec assuming the low-level representation is a String
. The encoding function uses the enum's .toString
. Similarly,
the decoding function performs a case-insensitive search using the enum's .toString