class GenericBinaryCodec extends GenericDerivationApi
- Alphabetic
- By Inheritance
- GenericBinaryCodec
- GenericDerivationApi
- LowerPriorityGenericDerivationApi
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- trait Symbols[H] extends AnyRef
Type class extracting the field names or constructor names of a labelled generic representation to a HList of Symbol values
Type class extracting the field names or constructor names of a labelled generic representation to a HList of Symbol values
- H
The LabelledGeneric representation of a type
- Definition Classes
- GenericDerivationApi
- trait TagTransients[H, AF, AC] extends AnyRef
Type class to tag a labelled generic representation of a type with a type level information about whether each field or constructor is marked as transient or not.
Type class to tag a labelled generic representation of a type with a type level information about whether each field or constructor is marked as transient or not.
For products 'H' is a HList, for coproducts it is a Coproduct, with each item being tagged with the field or constructor's name by LabelledGeneric, having a type of 'FieldType[K, V]'.
The result of this type-level operation, 'Result' is a HList or Coproduct where those fields or constructors that are having a transient attribute of transientField or transientConstructor are also tagged with the MarkedAsTransient tag, so each element is either 'FieldType[K, V]' or 'FieldType[K, MarkedAsTransient[V]]'.
This makes it possible to differentiate in compile time between transient and non-transient flags in the implementation of the DeserializationPlan and SerializationPlan type classes.
- H
The generic representation of the type
- AF
HList of the transientField annotations, extracted by Annotations
- AC
HList of the transientConstructor annotations, extracted by Annotations
- Definition Classes
- GenericDerivationApi
- trait ToConstructorMap[T] extends AnyRef
Type class to extract the type-level generic constructor names to a run-time vector of strings
Type class to extract the type-level generic constructor names to a run-time vector of strings
- T
The LabelledGeneric representation of a type tagged by TagTransients
- Definition Classes
- GenericDerivationApi
- trait ToConstructorMapLowPriority extends AnyRef
Lower priority implicits for the implementation of ToConstructorMap.
Lower priority implicits for the implementation of ToConstructorMap.
This enables capturing the MarkedAsTransient tagged constructors in the ToConstructorMap
- Definition Classes
- GenericDerivationApi
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
- implicit def clistDeserializer[K <: Symbol, H, T <: Coproduct](implicit witness: Aux[K], headCodec: Lazy[BinaryCodec[H]], tailPlan: DeserializationPlan[T]): DeserializationPlan[:+:[FieldType[K, H], T]]
- Definition Classes
- GenericBinaryCodec → LowerPriorityGenericDerivationApi
- implicit def clistSerializer[K <: Symbol, H, T <: Coproduct](implicit witness: Aux[K], headCodec: Lazy[BinaryCodec[H]], tailPlan: SerializationPlan[T]): SerializationPlan[:+:[FieldType[K, H], T]]
- Definition Classes
- GenericBinaryCodec → LowerPriorityGenericDerivationApi
- implicit def clistTransientDeserializer[K <: Symbol, H, T <: Coproduct](implicit witness: Aux[K], tailPlan: DeserializationPlan[T]): DeserializationPlan[:+:[FieldType[K, MarkedAsTransient[H]], T]]
- Definition Classes
- GenericBinaryCodec → GenericDerivationApi
- implicit def clistTransientSerializer[K <: Symbol, H, T <: Coproduct](implicit witness: Aux[K], tailPlan: SerializationPlan[T]): SerializationPlan[:+:[FieldType[K, MarkedAsTransient[H]], T]]
- Definition Classes
- GenericBinaryCodec → GenericDerivationApi
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- implicit val cnilDeserializer: DeserializationPlan[CNil]
- Definition Classes
- GenericBinaryCodec → GenericDerivationApi
- implicit val cnilSerializer: SerializationPlan[CNil]
- Definition Classes
- GenericBinaryCodec → GenericDerivationApi
- def derive[T, H, Ks <: HList, Trs <: HList, Trcs <: HList, KsTrs <: HList, TH](implicit gen: Aux[T, H], keys: Lazy[Aux[H, Ks]], transientAnnotations: Aux[transientField, T, Trs], transientConstructorAnnotations: Aux[transientConstructor, T, Trcs], taggedTransients: Aux[H, Trs, Trcs, TH], zip: Aux[::[Ks, ::[Trs, HNil]], KsTrs], toList: Aux[KsTrs, List, (Symbol, Option[transientField])], serializationPlan: Lazy[SerializationPlan[TH]], deserializationPlan: Lazy[DeserializationPlan[TH]], toConstructorMap: Lazy[ToConstructorMap[TH]], classTag: ClassTag[T]): BinaryCodec[T]
The entry point of deriving a generic binary codec for a type 'T'
The entry point of deriving a generic binary codec for a type 'T'
The derivation needs both type level and runtime information about the type it derives the codec for. On type level first the LabelledGeneric representation gets extracted into 'H'. This is either a HList of fields or a Coproduct of constructors. Then with Annotations it finds both the transientField and transientConstructor annotations for each field and constructor, stored in the 'Trs' and 'Trcs' types. Based on these the TagTransients type level operation constructs 'TH' where each field/constructor is tagged with its label and optionally as transient. This is the type which is then used recursively to generate the serializer and the deserializer through the implicits of SerializationPlan and DeserializationPlan.
For these serializer and deserializer operations we also need some runtime data. The ToConstructorMap type class extracts the name of non-transient constructors into a runtime Vector. This defines the association between constructors and numeric IDs.
It is not enough to have transient tags in type level because the transientField annotation also holds a default value. For this reason we need to be able to access the default value runtime as well, during the construction of the generic representation in the deserializer.
With 'keys', 'zip' and 'toList' we zip together the field names with the annotations and convert the result to a runtime Map.
- T
Type to derive the generic representation for
- H
Labelled generic representation of type 'T'
- Ks
HList of field/constructor names
- Trs
HList of optional transientField annotations per field/constructor
- Trcs
HList of optional transientConstructor annotations per field/constructor
- KsTrs
HList of pairs of Symbol and optional transientField values
- TH
Tagged generic representation of type 'T' produced by TagTransients
- gen
Extracts the labelled generic representation of type 'T' into 'H'
- keys
Gets the HList of field/constructor names of 'H' into 'Ks'
- transientAnnotations
Extracts the transientField annotations of 'T' into 'Trs'
- transientConstructorAnnotations
Extracts the transientConstructor annotations of 'T' into 'Trcs'
- taggedTransients
Tags the generic representation 'H' with transient tags based on 'Trs' and 'Trcs' into 'TH'
- zip
Creates a zipped list of 'Ks' and 'Trs', associating field names with transient annotations into 'KsTrs'
- toList
Extractor of the 'KsTrs' HList into a List of Symbol and optional transientField pairs
- serializationPlan
The serializer implementation for the tagged generic representation 'TH'
- deserializationPlan
The deserializer implementation for the tagged generic representation 'TH'
- toConstructorMap
Extracts the names of the constructors of a coproduct from the generic representation 'TH' into a runtime vector
- classTag
Class tag for the type 'T'
- returns
The derived BinaryCodec for type 'T'
- Definition Classes
- GenericBinaryCodec → GenericDerivationApi
- 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
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- implicit def hlistDeserializer[K <: Symbol, H, T <: HList](implicit witness: Aux[K], headCodec: Lazy[BinaryCodec[H]], tailPlan: DeserializationPlan[T]): DeserializationPlan[::[FieldType[K, H], T]]
- Definition Classes
- GenericBinaryCodec → LowerPriorityGenericDerivationApi
- implicit def hlistOptionalDeserializer[K <: Symbol, H, T <: HList](implicit witness: Aux[K], headCodec: Lazy[BinaryCodec[H]], optHeadCodec: Lazy[BinaryCodec[Option[H]]], tailPlan: DeserializationPlan[T]): DeserializationPlan[::[FieldType[K, Option[H]], T]]
- Definition Classes
- GenericBinaryCodec → GenericDerivationApi
- implicit def hlistSerializer[K <: Symbol, H, T <: HList](implicit witness: Aux[K], headCodec: Lazy[BinaryCodec[H]], tailPlan: SerializationPlan[T]): SerializationPlan[::[FieldType[K, H], T]]
- Definition Classes
- GenericBinaryCodec → LowerPriorityGenericDerivationApi
- implicit def hlistTransientDeserializer[K <: Symbol, H, T <: HList](implicit witness: Aux[K], tailPlan: DeserializationPlan[T]): DeserializationPlan[::[FieldType[K, MarkedAsTransient[H]], T]]
- Definition Classes
- GenericBinaryCodec → GenericDerivationApi
- implicit def hlistTransientSerializer[K <: Symbol, H, T <: HList](implicit witness: Aux[K], tailPlan: SerializationPlan[T]): SerializationPlan[::[FieldType[K, MarkedAsTransient[H]], T]]
- Definition Classes
- GenericBinaryCodec → GenericDerivationApi
- implicit val hnilDeserializer: DeserializationPlan[HNil]
- Definition Classes
- GenericBinaryCodec → GenericDerivationApi
- implicit val hnilSerializer: SerializationPlan[HNil]
- Definition Classes
- GenericBinaryCodec → GenericDerivationApi
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- 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])
- object Symbols
Implementation of the Symbols type class for both products and coproducts
Implementation of the Symbols type class for both products and coproducts
- Definition Classes
- GenericDerivationApi
- object TagTransients
Implementation of TagTransients for both products and coproducts
Implementation of TagTransients for both products and coproducts
- Definition Classes
- GenericDerivationApi
- object ToConstructorMap extends ToConstructorMapLowPriority
Implementation of the ToConstructorMap type class for both products and coproducts.
Implementation of the ToConstructorMap type class for both products and coproducts.
For products the result is always an empty vector. For coproducts the result if the vector of constructor names, except the ones marked as transient.
- Definition Classes
- GenericDerivationApi
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated