def connect[A, B]()

in bijection-core/src/main/scala-2.12-/com/twitter/bijection/Bijection.scala [80:109]


  def connect[A, B](implicit bij: ImplicitBijection[A, B]): Bijection[A, B] = bij.bijection
  def connect[A, B, C](implicit
      bij: ImplicitBijection[A, B],
      bij2: ImplicitBijection[B, C]
  ): Bijection[A, C] =
    (bij.bijection) andThen (bij2.bijection)
  def connect[A, B, C, D](implicit
      bij1: ImplicitBijection[A, B],
      bij2: ImplicitBijection[B, C],
      bij3: ImplicitBijection[C, D]
  ): Bijection[A, D] =
    connect[A, B, C] andThen (bij3.bijection)
  def connect[A, B, C, D, E](implicit
      bij1: ImplicitBijection[A, B],
      bij2: ImplicitBijection[B, C],
      bij3: ImplicitBijection[C, D],
      bij4: ImplicitBijection[D, E]
  ): Bijection[A, E] =
    connect[A, B, C, D] andThen (bij4.bijection)

  implicit def identity[A]: Bijection[A, A] = new IdentityBijection[A]

  /**
    * We check for default, and return None, else Some Note this never returns Some(default)
    */
  def filterDefault[A](default: A): Bijection[A, Option[A]] =
    new AbstractBijection[A, Option[A]] {
      def apply(a: A) = if (a == default) None else Some(a)
      override def invert(opt: Option[A]) = opt.getOrElse(default)
    }