trait
LabelledGeneric[T] extends Serializable
Type Members
-
abstract
type
Repr
Abstract Value Members
-
abstract
def
from(r: Repr): T
-
abstract
def
to(t: T): Repr
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
-
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
LabelledGeneric is similar to Generic, but includes information about field names or class names in addition to the raw structure.
Continuing the example from shapeless.Generic, we use LabelledGeneric to convert an object to an shapeless.HList:
Note that the representation does not include the labels! The labels are actually encoded in the generic type representation using shapeless.Witness types.
As with shapeless.Generic, the representation for Animal captures the subclass embedding rather than the fields in the class, using shapeless.Coproduct:
the type which this instance can convert to and from a labelled generic representation