com.twitter

bijection

package bijection

Bijection trait with numerous implementations.

A Bijection[A, B] is an invertible function from A -> B. Knowing that two types have this relationship can be very helpful for serialization (Bijection[T, Array[Byte]]]), communication between libraries (Bijection[MyTrait, YourTrait]) and many other purposes.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. bijection
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. type @@[T, Tag] = T with Tagged[Tag]

    Tag a type T with Tag.

    Tag a type T with Tag. The resulting type is a subtype of T.

    The resulting type is used to discriminate between type class instances.

  2. abstract class AbstractBijection[A, B] extends Bijection[A, B]

    Abstract class to ease Bijection creation from Java.

  3. abstract class AbstractBufferable[T] extends Bufferable[T]

    For Java and avoiding trait bloat

  4. abstract class AbstractInjection[A, B] extends Injection[A, B]

    Abstract class to ease Injection creation from Java (and reduce instance size in scala).

  5. type Attempt[T] = Try[T]

    Injections may not be defined for their inverse conversion.

    Injections may not be defined for their inverse conversion. This type represents the attempted conversion. A failure will result in a scala.util.Failure containing the InversionFailure. A success will result in a scala.util.Success containing the inverted value.

    TODO: Remove in 0.6.0.

  6. final case class Base64String(str: String) extends AnyVal with Product with Serializable

  7. trait Bijection[A, B] extends Serializable

    A Bijection[A, B] is a pair of functions that transform an element between types A and B isomorphically; that is, for all items,

  8. trait BinaryBijections extends StringBijections

    A collection of utilities for encoding strings and byte arrays to and decoding from strings compressed from with gzip.

  9. trait Bufferable[T] extends Serializable

    Bufferable[T] is a typeclass to work with java.

  10. class ClassBijection[T] extends Bijection[Class[T], @@[String, Rep[Class[T]]]]

    Bijection between Class objects and string.

  11. class ClassInjection[T] extends AbstractInjection[Class[T], String]

    Injection between Class objects and string.

  12. type Codec[T] = Injection[T, Array[Byte]]

    Using Injections for serialization is a common pattern.

    Using Injections for serialization is a common pattern. Currying the byte array parameter makes it easier to write code like this:

    def getProducer[T: Codec] = ...
  13. trait CollectionBijections extends BinaryBijections

  14. trait CollectionInjections extends StringInjections

  15. trait Conversion[A, B] extends Serializable

  16. final case class Convert[A](a: A) extends AnyVal with Product with Serializable

    Convert allows the user to convert an instance of type A to type B given an implicit Conversion that goes between the two.

  17. trait CrazyLowPriorityConversion extends Serializable

  18. final case class EnglishInt(get: String) extends AnyVal with Product with Serializable

  19. case class Forward[A, B](bijection: Bijection[A, B]) extends ImplicitBijection[A, B] with Product with Serializable

  20. final case class GZippedBase64String(str: String) extends AnyVal with Product with Serializable

  21. final case class GZippedBytes(bytes: Array[Byte]) extends AnyVal with Product with Serializable

  22. trait GeneratedTupleBijections extends LowPriorityBijections

  23. trait GeneratedTupleBufferable extends AnyRef

  24. trait GeneratedTupleCollectionInjections extends LowPriorityInjections

  25. trait GeneratedTupleInjections extends GeneratedTupleCollectionInjections

  26. trait HasRep[A, B] extends AnyRef

    Type class for summoning the function that can check whether the instance can be tagged with Rep

  27. class IdentityBijection[A] extends Bijection[A, A]

  28. sealed trait ImplicitBijection[A, B] extends Serializable

    Annotations
    @implicitNotFound( ... )
  29. trait Injection[A, B] extends Serializable

    An Injection[A, B] is a function from A to B, and from some B back to A.

  30. class IntModDivInjection extends Injection[Int, (Int, Int)]

    A common injection on numbers: N -> (m = N mod K, (N-m)/K) The first element in result tuple is always [0, modulus)

  31. case class InversionFailure(failed: Any, ex: Throwable) extends UnsupportedOperationException with Product with Serializable

    When Injection inversion attempts are known to fail, the attempt will encode an InversionFailure to represent that failure

  32. class JavaSerializationInjection[T <: Serializable] extends Injection[T, Array[Byte]]

    Use Java serialization to write/read bytes.

  33. class LongModDivInjection extends Injection[Long, (Long, Long)]

    A common injection on numbers: N -> (m = N mod K, (N-m)/K) The first element in result tuple is always [0, modulus)

  34. trait LowPriorityBijections extends AnyRef

  35. trait LowPriorityConversion extends NotSuperLowPriorityConversion

  36. trait LowPriorityImplicitBijection extends Serializable

  37. trait LowPriorityInjections extends AnyRef

  38. trait NotSuperLowPriorityConversion extends SuperLowPriorityConversion

  39. trait NumericBijections extends GeneratedTupleBijections

  40. trait NumericInjections extends GeneratedTupleInjections

  41. trait Pivot[K, K1, K2] extends Bijection[Iterable[K], Map[K1, Iterable[K2]]]

    Pivot is useful in moving from a 1D space of K to a 2D mapping space of K1 x K2.

  42. trait PivotDecoder[K, K1, K2] extends (Map[K1, Iterable[K2]]) ⇒ Iterable[K] with Serializable

  43. trait PivotEncoder[K, K1, K2] extends (Iterable[K]) ⇒ Map[K1, Iterable[K2]] with Serializable

  44. class PivotImpl[K, K1, K2] extends Pivot[K, K1, K2]

  45. trait Rep[A] extends AnyRef

    Type tag used to indicate that an instance of a type such as String contains a valid representation of another type, such as Int or URL.

  46. case class Reverse[A, B](inv: Bijection[B, A]) extends ImplicitBijection[A, B] with Product with Serializable

  47. trait StringBijections extends NumericBijections

  48. trait StringInjections extends NumericInjections

  49. abstract class SubclassBijection[A, B <: A] extends Bijection[A, B]

    When you have conversion between A and B where B is a subclass of A, which is often free, i.

  50. trait SuperLowPriorityConversion extends CrazyLowPriorityConversion

  51. type Tagged[T] = AnyRef { type Tag = T }

    Tagging infrastructure.

Value Members

  1. object Base64String extends Serializable

  2. object Bijection extends CollectionBijections with Serializable

  3. object Bufferable extends GeneratedTupleBufferable with Serializable

  4. object CastInjection

    Injection to cast back and forth between two types.

  5. object ClassBijection extends Serializable

  6. object Conversion extends LowPriorityConversion

  7. object EnglishInt extends Serializable

  8. object ImplicitBijection extends LowPriorityImplicitBijection

  9. object Injection extends CollectionInjections with Serializable

  10. object Inversion

    Factory for applying inversion attempts

  11. object InversionFailure extends Serializable

    Factory for producing InversionFailures

  12. object JavaSerializationInjection extends Serializable

  13. object NumberSystems

  14. object Pivot extends Serializable

  15. object Rep

    Useful HasRep

  16. object StringCodec extends StringInjections

  17. object StringJoinBijection

    Bijection for joining together iterables of strings into a single string and splitting them back out.

  18. object SwapBijection

    Bijection that flips the order of items in a Tuple2.

  19. package codec

Inherited from AnyRef

Inherited from Any

Ungrouped