Trait

magnolia

Param

Related Doc: package magnolia

Permalink

trait Param[Typeclass[_], Type] extends Serializable

represents a parameter of a case class

Typeclass

type constructor for the typeclass being derived

Type

generic type of this parameter

Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Param
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract type PType

    Permalink

    the type of the parameter being represented

    the type of the parameter being represented

    For example, for a case class,

     case class Person(name: String, age: Int)
    
    the Param instance corresponding to the age parameter would have a PType equal to the type scala.Int. However, in practice, this type will never be universally quantified.

Abstract Value Members

  1. abstract def annotationsArray: Array[Any]

    Permalink
  2. abstract def default: Option[PType]

    Permalink

    provides the default value for this parameter, as defined in the case class constructor

  3. abstract def dereference(param: Type): PType

    Permalink

    dereferences a value of the case class type, Type, to access the value of the parameter being represented

    dereferences a value of the case class type, Type, to access the value of the parameter being represented

    When programming generically, against an unknown case class, with unknown parameter names and types, it is not possible to directly access the parameter values without reflection, which is undesirable. This method, whose implementation is provided by the Magnolia macro, will dereference a case class instance to access the parameter corresponding to this Param.

    Whilst the type of the resultant parameter value cannot be universally known at the use, its type will be existentially quantified on this Param instance, and the return type of the corresponding typeclass method will be existentially quantified on the same value. This is sufficient for the compiler to determine that the two values are compatible, and the value may be applied to the typeclass (in whatever way that particular typeclass provides).

    param

    the instance of the case class to be dereferenced

    returns

    the parameter value

  4. abstract def index: Int

    Permalink
  5. abstract def label: String

    Permalink

    the name of the parameter

  6. abstract def repeated: Boolean

    Permalink

    flag indicating a repeated (aka.

    flag indicating a repeated (aka. vararg) parameter

    For example, for a case class,

    case class Account(id: String, emails: String*)
    
    the Param instance corresponding to the emails parameter would be repeated and have a PType equal to the type Seq[String]. Note that only the last parameter of a case class can be repeated.

  7. abstract def typeclass: Typeclass[PType]

    Permalink

    the typeclass instance associated with this parameter

    the typeclass instance associated with this parameter

    This is the instance of the type Typeclass[PType] which will have been discovered by implicit search, or derived by Magnolia.

    Its type is existentially quantified on this Param instance, and depending on the nature of the particular typeclass, it may either accept or produce types which are also existentially quantified on this same Param instance.

Concrete 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. final def annotations: Seq[Any]

    Permalink

    a sequence of objects representing all of the annotations on the case class

    a sequence of objects representing all of the annotations on the case class

    For efficiency, this sequence is implemented by an Array, but upcast to a scala.collection.Seq to hide the mutable collection API.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  16. final def synchronized[T0](arg0: ⇒ T0): T0

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

    Permalink
    Definition Classes
    Param → AnyRef → Any
  18. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped