object Mappings
Usage examples:
Constructor that never fails:
case class Foo(value: String) object Foo extends (String => Foo) { private val mapping = Mappings.map[String, Foo](Foo, _.value) implicit val jsonFormat = mapping.jsonReads implicit val pathBindable = mapping.pathBindable implicit val queryStringBindable = mapping.queryStringBindable }
Constructor that may fail:
case class Bar(value: String) { require(value.nonEmpty) } object Bar { private val mapping = Mappings.mapTry[String, Foo](s => Try(Foo(s)), _.value) implicit val jsonFormat = mapping.jsonReads implicit val pathBindable = mapping.pathBindable implicit val queryStringBindable = mapping.queryStringBindable }
Enumeration:
sealed trait Base case object Thing1 extends Base case object Thing2 extends Base object Base { private val mapping = Mappings.mapEnum(Thing1, Thing2) def fromString(name: String): Option[Base] = mapping.fromString(name) implicit val jsonFormat = mapping.jsonReads implicit val pathBindable = mapping.pathBindable implicit val queryStringBindable = mapping.queryStringBindable }
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- Mappings
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[A, B](toDomain: (A) => B, fromDomain: (B) => A): Mapping[A, B]
- def mapEither[A, B](toDomain: (A) => Either[String, B], fromDomain: (B) => A): Mapping[A, B]
- def mapEnum[B](elements: B*)(implicit arg0: ClassTag[B]): EnumMapping[B]
- def mapOption[A, B](toDomain: (A) => Option[B], fromDomain: (B) => A)(implicit arg0: ClassTag[B]): Mapping[A, B]
- def mapTry[A, B](toDomain: (A) => Try[B], fromDomain: (B) => A): Mapping[A, B]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)