Class

com.avsystem.commons.macros.serialization

GenCodecMacros

Related Doc: package serialization

Permalink

class GenCodecMacros extends CodecMacroCommons with TypeClassDerivation

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. GenCodecMacros
  2. TypeClassDerivation
  3. CodecMacroCommons
  4. AbstractMacroCommons
  5. MacroCommons
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new GenCodecMacros(ctx: Context)

    Permalink

Type Members

  1. case class ApplyParam(sym: scala.reflect.macros.Universe.TermSymbol, defaultValue: scala.reflect.macros.Universe.Tree, instance: scala.reflect.macros.Universe.Tree) extends Product with Serializable

    Permalink

    Contains metadata extracted from apply method of companion object of some record (case-class like) type.

    Contains metadata extracted from apply method of companion object of some record (case-class like) type.

    sym

    symbol of the apply method parameter or case class constructor parameter (if apply is auto-generated for case class companion object)

    defaultValue

    tree that evaluates to default value of the apply parameter or EmptyTree

    instance

    tree that evaluates to type class instance for type of this parameter

    Definition Classes
    TypeClassDerivation
  2. case class ApplyUnapply(apply: scala.reflect.macros.Universe.Symbol, unapply: scala.reflect.macros.Universe.Symbol, params: List[(scala.reflect.macros.Universe.TermSymbol, scala.reflect.macros.Universe.Tree)]) extends Product with Serializable

    Permalink
    Definition Classes
    MacroCommons
  3. case class KnownSubtype(tpe: scala.reflect.macros.Universe.Type, instance: scala.reflect.macros.Universe.Tree) extends Product with Serializable

    Permalink

    Contains metadata extracted from one of the case subtypes in a sealed hierarchy.

    Contains metadata extracted from one of the case subtypes in a sealed hierarchy.

    tpe

    the case subtype itself

    instance

    tree that evaluates to type class instance for this subtype

    Definition Classes
    TypeClassDerivation
  4. case class TypeKey(tpe: scala.reflect.macros.Universe.Type) extends Product with Serializable

    Permalink
    Definition Classes
    MacroCommons
  5. implicit class treeOps[T <: scala.reflect.macros.Universe.Tree] extends AnyRef

    Permalink
    Definition Classes
    MacroCommons

Value Members

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. val AllowImplicitMacroCls: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    TypeClassDerivation
  5. val AllowImplicitMacroObj: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    TypeClassDerivation
  6. val BMapCls: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    CodecMacroCommons
  7. val CollectionPkg: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  8. val CommonsPackage: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  9. val DeferredInstanceCls: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    TypeClassDerivation
  10. object ExistentialSingleton

    Permalink
    Definition Classes
    MacroCommons
  11. val FutureSym: scala.reflect.macros.Universe.Symbol

    Permalink
    Definition Classes
    MacroCommons
  12. val GenCodecCls: scala.reflect.macros.Universe.Select

    Permalink
  13. val GenCodecObj: scala.reflect.macros.Universe.Select

    Permalink
  14. val ImplicitsObj: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  15. val JListCls: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    CodecMacroCommons
  16. val JListObj: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    CodecMacroCommons
  17. val JavaInteropObj: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    CodecMacroCommons
  18. val ListBufferCls: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    CodecMacroCommons
  19. val ListCls: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  20. val ListObj: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  21. val MapObj: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  22. val MaterializedCls: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  23. val NOptCls: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    CodecMacroCommons
  24. val NOptObj: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    CodecMacroCommons
  25. val NameAnnotType: scala.reflect.macros.Universe.Type

    Permalink
    Definition Classes
    CodecMacroCommons
  26. val NilObj: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  27. val NoneObj: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  28. val OptionClass: scala.reflect.macros.Universe.ClassSymbol

    Permalink
    Definition Classes
    MacroCommons
  29. val OptionCls: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  30. val RecursiveImplicitMarkerObj: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    TypeClassDerivation
  31. val ScalaPkg: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  32. val SerializationPkg: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    CodecMacroCommons
  33. val SomeObj: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  34. val TransientDefaultAnnotType: scala.reflect.macros.Universe.Type

    Permalink
  35. val TransparentAnnotType: scala.reflect.macros.Universe.Type

    Permalink
  36. val UnitCls: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    MacroCommons
  37. def abort(msg: String): Nothing

    Permalink
    Definition Classes
    MacroCommons
  38. def abortOnTypecheckException[T](expr: ⇒ T): T

    Permalink
    Definition Classes
    MacroCommons
  39. def allAnnotations(s: scala.reflect.macros.Universe.Symbol): List[scala.reflect.macros.Universe.Annotation]

    Permalink
    Definition Classes
    MacroCommons
  40. def allCurrentlyKnownSubclasses(sym: scala.reflect.macros.Universe.Symbol): Set[scala.reflect.macros.Universe.Symbol]

    Permalink
    Definition Classes
    MacroCommons
  41. def alternatives(sym: scala.reflect.macros.Universe.Symbol): List[scala.reflect.macros.Universe.Symbol]

    Permalink
    Definition Classes
    MacroCommons
  42. def annotName(sym: scala.reflect.macros.Universe.Symbol): String

    Permalink
    Definition Classes
    CodecMacroCommons
  43. def applyUnapplyFor(tpe: scala.reflect.macros.Universe.Type): Option[ApplyUnapply]

    Permalink
    Definition Classes
    MacroCommons
  44. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  45. val c: Context

    Permalink
    Definition Classes
    AbstractMacroCommonsMacroCommons
  46. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. def determineTypeParams(undetTpe: scala.reflect.macros.Universe.Type, detTpe: scala.reflect.macros.Universe.Type, typeParams: List[scala.reflect.macros.Universe.Symbol]): Option[List[scala.reflect.macros.Universe.Type]]

    Permalink
    Definition Classes
    MacroCommons
  48. def echo(msg: String): Unit

    Permalink
    Definition Classes
    MacroCommons
  49. lazy val enclosingClasses: List[scala.reflect.macros.blackbox.Context.Symbol]

    Permalink
    Definition Classes
    MacroCommons
  50. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  51. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  52. def error(msg: String): Unit

    Permalink
    Definition Classes
    MacroCommons
  53. def existentialSingletonToValDef(sym: scala.reflect.macros.Universe.Symbol, name: scala.reflect.macros.Universe.TermName, tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.ValDef

    Permalink
    Definition Classes
    MacroCommons
  54. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  55. def forApplyUnapply(tpe: scala.reflect.macros.Universe.Type, apply: scala.reflect.macros.Universe.Symbol, unapply: scala.reflect.macros.Universe.Symbol, params: List[ApplyParam]): scala.reflect.macros.Universe.Tree

    Permalink

    Derives type class instance for record type.

    Derives type class instance for record type. Record type is a class/trait whose companion object has matching apply and unapply methods. In particular, every case class is a proper record type.

    tpe

    the record type

    apply

    symbol of the apply method in companion object

    unapply

    symbol of the unapply method in companion object

    params

    metadata for parameters of apply method

    Definition Classes
    GenCodecMacrosTypeClassDerivation
  56. def forSealedEnum[T](implicit arg0: scala.reflect.macros.blackbox.Context.WeakTypeTag[T]): scala.reflect.macros.Universe.Tree

    Permalink
  57. def forSealedHierarchy(tpe: scala.reflect.macros.Universe.Type, subtypes: List[KnownSubtype]): scala.reflect.macros.Universe.Tree

    Permalink

    Derives type class instance for union type (sealed hierarchy in which every non-abstract subtype has the type class instance of its own or can also be automatically derived).

    Derives type class instance for union type (sealed hierarchy in which every non-abstract subtype has the type class instance of its own or can also be automatically derived).

    tpe

    type of the sealed class/trait

    subtypes

    metadata for all direct non-abstract subtypes of this sealed class/trait

    Definition Classes
    GenCodecMacrosTypeClassDerivation
  58. def forSingleton(tpe: scala.reflect.macros.Universe.Type, singleValueTree: scala.reflect.macros.Universe.Tree): scala.reflect.macros.Universe.Tree

    Permalink

    Derives type class instance for singleton type (i.e.

    Derives type class instance for singleton type (i.e. an object or this)

    tpe

    the singleton type

    singleValueTree

    a tree that evaluates to the sole value of the singleton type

    Definition Classes
    GenCodecMacrosTypeClassDerivation
  59. def forUnknown(tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Tree

    Permalink

    Derives type class instance for arbitrary type which is neither a singleton, record nor union type.

    Derives type class instance for arbitrary type which is neither a singleton, record nor union type. Usually, you want to throw a TypecheckException to indicate that type class instance cannot be derived for this type. You can use typecheckException method for this.

    Definition Classes
    GenCodecMacrosTypeClassDerivation
  60. def getAnnotations(sym: scala.reflect.macros.Universe.Symbol, annotTpe: scala.reflect.macros.Universe.Type): List[scala.reflect.macros.Universe.Annotation]

    Permalink
    Definition Classes
    CodecMacroCommons
  61. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  62. def getType(typeTree: scala.reflect.macros.Universe.Tree): scala.reflect.macros.Universe.Type

    Permalink
    Definition Classes
    MacroCommons
  63. def getterSymbolToValDef(sym: scala.reflect.macros.Universe.Symbol): scala.reflect.macros.Universe.ValDef

    Permalink
    Definition Classes
    MacroCommons
  64. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  65. def implementDeferredInstance(tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Tree

    Permalink

    Returns tree that instantiates a "deferred instance" of this type class.

    Returns tree that instantiates a "deferred instance" of this type class. Deferred instance is a special implementation of the type class which implements the com.avsystem.commons.derivation.DeferredInstance trait and wraps an another, actual instance of the type class and delegates all operations to that wrapped instance. The wrapped instance itself is supplied later, by assigning a var available on the deferred instance.

    This is all necessary to handle automatic derivation for recursively-defined types like:

    case class Tree(children: List[Tree])

    EXAMPLE:

    Let's assume a type class Traverser defined like this:

    trait Traverser[T] {
      def traverse(value: T): Unit
    }
    object Traverser {
      class Deferred[T] extends DeferredInstance[Traverser[T]] with Traverser[T] {
        def traverse(value: T) = underlying.traverse(value)
      }
    
      implicit def forList[T](implicit forElement: Traverser[T]): Traverser[List[T]] =
        new Traverser[List[T]] {
          def traverse(value: List[T]) = value.foreach(forElement.traverse)
        }
    }

    Automatically derived type class instance for Tree would then look somewhat like this:

    val tcTree: Traverser[Tree] = {
      val deferred: DeferredInstance[Traverser[Tree]] with Traverser[Tree] = new Traverser.Deferred[T]
      deferred.underlying = new Traverser[Tree] {
        val forChildren = Traverser.forList[Tree](deferred)
        def traverse(value: Tree) = value.children.foreach(forChildren.traverse)
      }
      deferred.underlying
    }
    Definition Classes
    GenCodecMacrosTypeClassDerivation
  66. def inferOrMaterialize(typeClass: scala.reflect.macros.Universe.Type)(materialize: ⇒ scala.reflect.macros.Universe.Tree): scala.reflect.macros.Universe.Tree

    Permalink
    Definition Classes
    MacroCommons
  67. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  68. def isSealedHierarchyRoot(sym: scala.reflect.macros.Universe.Symbol): Boolean

    Permalink
    Definition Classes
    MacroCommons
  69. def isTransientDefault(param: ApplyParam): Boolean

    Permalink
  70. def isTransparent(sym: scala.reflect.macros.Universe.Symbol): Boolean

    Permalink
  71. def isTypeTree(tree: scala.reflect.macros.Universe.Tree): Boolean

    Permalink
    Definition Classes
    MacroCommons
  72. def knownNonAbstractSubclasses(sym: scala.reflect.macros.Universe.Symbol): Set[scala.reflect.macros.Universe.Symbol]

    Permalink
    Definition Classes
    MacroCommons
  73. def knownSubtypes(tpe: scala.reflect.macros.Universe.Type): Option[List[scala.reflect.macros.Universe.Type]]

    Permalink
    Definition Classes
    MacroCommons
  74. def materialize[T](implicit arg0: scala.reflect.macros.blackbox.Context.WeakTypeTag[T]): scala.reflect.macros.Universe.Tree

    Permalink
    Definition Classes
    TypeClassDerivation
  75. def materializeAuto[T](implicit arg0: scala.reflect.macros.blackbox.Context.WeakTypeTag[T]): scala.reflect.macros.Universe.Tree

    Permalink
    Definition Classes
    TypeClassDerivation
  76. def materializeFor(tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Tree

    Permalink
    Definition Classes
    TypeClassDerivation
  77. def materializeImplicitly[T](allow: scala.reflect.macros.Universe.Tree)(implicit arg0: scala.reflect.macros.blackbox.Context.WeakTypeTag[T]): scala.reflect.macros.Universe.Tree

    Permalink
    Definition Classes
    TypeClassDerivation
  78. def materializeMacroCodec[T](implicit arg0: scala.reflect.macros.blackbox.Context.WeakTypeTag[T]): scala.reflect.macros.Universe.Tree

    Permalink
  79. def materializeRecursively[T](implicit arg0: scala.reflect.macros.blackbox.Context.WeakTypeTag[T]): scala.reflect.macros.Universe.Tree

    Permalink
  80. def methodSymbolToDefDef(sym: scala.reflect.macros.Universe.Symbol): scala.reflect.macros.Universe.DefDef

    Permalink
    Definition Classes
    MacroCommons
  81. def mkTupleCodec[T](elementCodecs: scala.reflect.macros.blackbox.Context.Tree*)(implicit arg0: scala.reflect.macros.blackbox.Context.WeakTypeTag[T]): scala.reflect.macros.blackbox.Context.Tree

    Permalink
  82. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  83. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  84. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  85. lazy val ownerChain: List[scala.reflect.macros.Universe.Symbol]

    Permalink
    Definition Classes
    MacroCommons
  86. def paramSymbolToValDef(sym: scala.reflect.macros.Universe.Symbol): scala.reflect.macros.Universe.ValDef

    Permalink
    Definition Classes
    MacroCommons
  87. def pathTo(sym: scala.reflect.macros.Universe.Symbol): scala.reflect.macros.Universe.Tree

    Permalink
    Definition Classes
    MacroCommons
  88. def select(pre: scala.reflect.macros.Universe.Tree, name: scala.reflect.macros.Universe.Name): scala.reflect.macros.Universe.Tree

    Permalink
    Definition Classes
    MacroCommons
  89. def singleValueFor(tpe: scala.reflect.macros.Universe.Type): Option[scala.reflect.macros.Universe.Tree]

    Permalink
    Definition Classes
    MacroCommons
  90. def superSymbols(s: scala.reflect.macros.Universe.Symbol): List[scala.reflect.macros.Universe.Symbol]

    Permalink
    Definition Classes
    MacroCommons
  91. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  92. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  93. def treeForType(tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Tree

    Permalink

    Returns a Tree that should typecheck to the type passed as argument (without using TypeTree).

    Returns a Tree that should typecheck to the type passed as argument (without using TypeTree).

    Definition Classes
    MacroCommons
  94. def tupleGet(i: Int): scala.reflect.macros.Universe.TermName

    Permalink
    Definition Classes
    CodecMacroCommons
  95. def typeClass: scala.reflect.macros.Universe.Select

    Permalink

    A tree that represents type constructor of the type class to be derived.

    A tree that represents type constructor of the type class to be derived.

    Definition Classes
    GenCodecMacrosTypeClassDerivation
  96. def typeClassInstance(tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Type

    Permalink
    Definition Classes
    TypeClassDerivation
  97. def typeClassName: String

    Permalink

    Human-friendly name of the type class.

    Human-friendly name of the type class. Used in error messages.

    Definition Classes
    GenCodecMacrosTypeClassDerivation
  98. def typeOfTypeSymbol(sym: scala.reflect.macros.Universe.TypeSymbol): scala.reflect.macros.Universe.Type

    Permalink
    Definition Classes
    MacroCommons
  99. def typeSymbolToTypeDef(sym: scala.reflect.macros.Universe.Symbol, forMethod: Boolean = false): scala.reflect.macros.Universe.TypeDef

    Permalink
    Definition Classes
    MacroCommons
  100. def typecheckException(msg: String): Nothing

    Permalink
    Definition Classes
    MacroCommons
  101. def unwrapNullaryMt(tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Type

    Permalink
    Definition Classes
    MacroCommons
  102. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  103. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  104. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  105. def warning(msg: String): Unit

    Permalink
    Definition Classes
    MacroCommons
  106. def withKnownSubclassesCheck(tree: scala.reflect.macros.Universe.Tree, tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Tree

    Permalink
    Definition Classes
    MacroCommons
  107. def wrapInAuto(tree: scala.reflect.macros.Universe.Tree): scala.reflect.macros.Universe.Tree

    Permalink

    Wraps the tree that evaluates to some instance of the type class into a tree that evaluates to an "auto" version of this type class.

    Wraps the tree that evaluates to some instance of the type class into a tree that evaluates to an "auto" version of this type class.

    Definition Classes
    GenCodecMacrosTypeClassDerivation

Inherited from TypeClassDerivation

Inherited from CodecMacroCommons

Inherited from AbstractMacroCommons

Inherited from MacroCommons

Inherited from AnyRef

Inherited from Any

Ungrouped