All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aecor.encoding.AnyValKeyDecoder.scala Maven / Gradle / Ivy

There is a newer version: 0.19.0
Show newest version
package aecor.encoding

import shapeless.Unwrapped

private[encoding] sealed abstract class AnyValKeyDecoder[A] extends KeyDecoder[A]
private[encoding] object AnyValKeyDecoder {
  implicit def instance[A <: AnyVal, U](implicit A: Unwrapped.Aux[A, U],
                              U: KeyDecoder[U]): AnyValKeyDecoder[A] =
    new AnyValKeyDecoder[A] {
      final override def apply(key: String): Option[A] =
        U.decode(key).map(A.wrap)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy