Packages

t

io.github.vigoo.desert.shapeless

GenericDerivationApi

trait GenericDerivationApi extends LowerPriorityGenericDerivationApi

Trait containing the public interface for the generic binary codec.

As there is no single global generic derivation implementation because it is parameteric with the evolution steps, a specific type's codec derviation is possible by accessing the necessary implicits (for HLists and Coproducts) via this interface.

The two type classes implemented for both products and coproducts are SerializationPlan and DeserializationPlan. These monads are more specific than the BinarySerializer and BinaryDeserializer, holding state specific for a single evolvable value's serialization.

Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. GenericDerivationApi
  2. LowerPriorityGenericDerivationApi
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. 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

  2. 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

  3. 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

  4. 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

Abstract Value Members

  1. implicit abstract def clistDeserializer[K <: Symbol, H, T <: Coproduct](implicit witness: Aux[K], headCodec: Lazy[BinaryCodec[H]], tailPlan: DeserializationPlan[T]): DeserializationPlan[:+:[FieldType[K, H], T]]
  2. implicit abstract def clistSerializer[K <: Symbol, H, T <: Coproduct](implicit witness: Aux[K], headCodec: Lazy[BinaryCodec[H]], tailPlan: SerializationPlan[T]): SerializationPlan[:+:[FieldType[K, H], T]]
  3. implicit abstract def clistTransientDeserializer[K <: Symbol, H, T <: Coproduct](implicit witness: Aux[K], tailPlan: DeserializationPlan[T]): DeserializationPlan[:+:[FieldType[K, MarkedAsTransient[H]], T]]
  4. implicit abstract def clistTransientSerializer[K <: Symbol, H, T <: Coproduct](implicit witness: Aux[K], tailPlan: SerializationPlan[T]): SerializationPlan[:+:[FieldType[K, MarkedAsTransient[H]], T]]
  5. implicit abstract val cnilDeserializer: DeserializationPlan[CNil]
  6. implicit abstract val cnilSerializer: SerializationPlan[CNil]
  7. abstract 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'

  8. implicit abstract def hlistDeserializer[K <: Symbol, H, T <: HList](implicit witness: Aux[K], headCodec: Lazy[BinaryCodec[H]], tailPlan: DeserializationPlan[T]): DeserializationPlan[::[FieldType[K, H], T]]
  9. implicit abstract 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]]
  10. implicit abstract def hlistSerializer[K <: Symbol, H, T <: HList](implicit witness: Aux[K], headCodec: Lazy[BinaryCodec[H]], tailPlan: SerializationPlan[T]): SerializationPlan[::[FieldType[K, H], T]]
  11. implicit abstract def hlistTransientDeserializer[K <: Symbol, H, T <: HList](implicit witness: Aux[K], tailPlan: DeserializationPlan[T]): DeserializationPlan[::[FieldType[K, MarkedAsTransient[H]], T]]
  12. implicit abstract def hlistTransientSerializer[K <: Symbol, H, T <: HList](implicit witness: Aux[K], tailPlan: SerializationPlan[T]): SerializationPlan[::[FieldType[K, MarkedAsTransient[H]], T]]
  13. implicit abstract val hnilDeserializer: DeserializationPlan[HNil]
  14. implicit abstract val hnilSerializer: SerializationPlan[HNil]

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  15. def toString(): String
    Definition Classes
    AnyRef → Any
  16. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  17. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  19. object Symbols

    Implementation of the Symbols type class for both products and coproducts

  20. object TagTransients

    Implementation of TagTransients for both products and coproducts

  21. 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.

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped