Class

com.avsystem.commons.serialization.GenCodec

Auto

Related Doc: package GenCodec

Permalink

final case class Auto[T](codec: GenCodec[T]) extends AnyVal with Product with Serializable

Wrapper over GenCodec which forces fully automatic derivation.

If you ask for implicit value of type GenCodec[T], the codec must be explicitly declared and imported or put into implicit scope (e.g. companion object of T), even though it can be automatically implemented using materialize or materializeRecursively.

However, if you ask for implicit value of type GenCodec.Auto[T], the compiler will always fall back to fully automatic derivation if it cannot find already declared GenCodec. Note that since GenCodec.Auto will always try to wrap already existing GenCodec (if there is one), you should never explicitly declare any instances of GenCodec.Auto. If you need custom serialization, just write a GenCodec and GenCodec.Auto will wrap it.

Whether you want to use GenCodec or GenCodec.Auto depends on your use case. GenCodec should be generally used when you want the programmer to always explicitly state that some type is serializable. For example, if you serialize your objects in order to put them into database, you probably want to use GenCodec and not GenCodec.Auto, because every type that has been written to database is likely to be bound by backwards compatibility constraints and cannot be freely refactored. That's why you want to always explicitly make the decision of making a type serializable.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Auto
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyVal
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Auto(codec: GenCodec[T])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. val codec: GenCodec[T]

    Permalink
  6. def getClass(): Class[_ <: AnyVal]

    Permalink
    Definition Classes
    AnyVal → Any
  7. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyVal

Inherited from Any

Ungrouped