Class

com.avsystem.commons.macros.serialization

GenCodecMacros

Related Doc: package serialization

Permalink

class GenCodecMacros extends TypeClassDerivation with CodecMacroCommons

Author: ghik Created: 10/12/15.

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

Instance Constructors

  1. new GenCodecMacros(c: Context)

    Permalink

Type Members

  1. case class ApplyParam(sym: scala.reflect.macros.Universe.Symbol, 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

    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(companion: scala.reflect.macros.Universe.Symbol, params: List[(scala.reflect.macros.Universe.Symbol, 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 BMapCls: scala.reflect.macros.Universe.Select

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

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

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

    Permalink
    Definition Classes
    TypeClassDerivation
  8. object ExistentialSingleton

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

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

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

    Permalink
  12. val JListCls: scala.reflect.macros.Universe.Select

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Permalink
  32. def abort(msg: String): Nothing

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    Any
  40. val c: Context

    Permalink
    Definition Classes
    GenCodecMacrosMacroCommons
  41. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. 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
  43. def echo(msg: String): Unit

    Permalink
    Definition Classes
    MacroCommons
  44. lazy val enclosingClasses: List[scala.reflect.macros.Universe.Symbol]

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

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

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

    Permalink
    Definition Classes
    MacroCommons
  48. 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
  49. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  50. def forApplyUnapply(tpe: scala.reflect.macros.Universe.Type, companion: 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

    companion

    symbol of the companion object of record type; can be used to refer to apply and unapply methods

    params

    metadata for parameters of apply method

    Definition Classes
    GenCodecMacrosTypeClassDerivation
  51. 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
  52. 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
  53. 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
  54. def getAnnotations(sym: scala.reflect.macros.Universe.Symbol, annotTpe: scala.reflect.macros.Universe.Type): List[scala.reflect.macros.Universe.Annotation]

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  59. 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
  60. final def isInstanceOf[T0]: Boolean

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

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

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

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

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

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

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

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

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

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

    Permalink
  71. val materializeRecursivelyCls: scala.reflect.macros.Universe.Select

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

    Permalink
  73. val materializeRecursivelyObj: scala.reflect.macros.Universe.Select

    Permalink
    Definition Classes
    TypeClassDerivation
  74. def methodSymbolToDefDef(sym: scala.reflect.macros.Universe.Symbol): scala.reflect.macros.Universe.DefDef

    Permalink
    Definition Classes
    MacroCommons
  75. 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
  76. final def ne(arg0: AnyRef): Boolean

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

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

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

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  87. 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
  88. def tupleGet(i: Int): scala.reflect.macros.Universe.TermName

    Permalink
    Definition Classes
    CodecMacroCommons
  89. 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
  90. def typeClassInstance(tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Type

    Permalink
    Definition Classes
    TypeClassDerivation
  91. 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
  92. def typeOfTypeSymbol(sym: scala.reflect.macros.Universe.TypeSymbol): scala.reflect.macros.Universe.Type

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

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    MacroCommons
  101. 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 CodecMacroCommons

Inherited from TypeClassDerivation

Inherited from MacroCommons

Inherited from AnyRef

Inherited from Any

Ungrouped