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.
- Alphabetic
- By Inheritance
- Auto
- Serializable
- Serializable
- Product
- Equals
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- val codec: GenCodec[T]
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any