Class

slick.lifted

ProductClassShape

Related Doc: package lifted

Permalink

class ProductClassShape[E <: Product, C <: Product] extends MappedScalaProductShape[FlatShapeLevel, Product, C, E, C]

A generic Product class shape that can be used to lift a class of plain Scala types to a class of lifted types. This allows the type to be used as a record type (like tuples and HLists) in the Lifted Embedding.

This can help with mapping tables >22 columns to classes, especially when using code generation. This can be used for Scala 2.11 case classes >22 fields.

Example:

def columnShape[T](implicit s: Shape[FlatShapeLevel, Column[T], T, Column[T]]) = s
class C(val a: Int, val b: Option[String]) extends Product{
  def canEqual(that: Any): Boolean = that.isInstanceOf[C]
  def productArity: Int = 2
  def productElement(n: Int): Any = Seq(a, b)(n)
}
class LiftedC(val a: Column[Int], val b: Column[Option[String]]) extends Product{
  def canEqual(that: Any): Boolean = that.isInstanceOf[LiftedC]
  def productArity: Int = 2
  def productElement(n: Int): Any = Seq(a, b)(n)
}
implicit object cShape extends ProductClassShape(
  Seq(columnShape[Int], columnShape[Option[String]]),
  seq => new LiftedC(seq(0).asInstanceOf[Column[Int]], seq(1).asInstanceOf[Column[Option[String]]]),
  seq => new C(seq(0).asInstanceOf[Int], seq(1).asInstanceOf[Option[String]])
)
Source
Shape.scala
Linear Supertypes
MappedScalaProductShape[FlatShapeLevel, Product, C, E, C], MappedProductShape[FlatShapeLevel, Product, C, E, C], ProductNodeShape[FlatShapeLevel, Product, C, E, C], Shape[FlatShapeLevel, C, E, C], AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ProductClassShape
  2. MappedScalaProductShape
  3. MappedProductShape
  4. ProductNodeShape
  5. Shape
  6. AnyRef
  7. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ProductClassShape(shapes: Seq[Shape[_, _, _, _]], mapLifted: (Seq[Any]) ⇒ C, mapPlain: (Seq[Any]) ⇒ E)(implicit classTag: ClassTag[E])

    Permalink

Type Members

  1. type Mixed = C

    Permalink
    Definition Classes
    Shape
  2. type Packed = C

    Permalink
    Definition Classes
    Shape
  3. type Unpacked = E

    Permalink
    Definition Classes
    Shape

Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from ProductClassShape[E, C] to any2stringadd[ProductClassShape[E, C]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (ProductClassShape[E, C], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from ProductClassShape[E, C] to ArrowAssoc[ProductClassShape[E, C]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def buildParams(extract: (Any) ⇒ Unpacked): Packed

    Permalink

    Build a packed representation containing QueryParameters that can extract data from the unpacked representation later.

    Build a packed representation containing QueryParameters that can extract data from the unpacked representation later. This method is not available for shapes where Mixed and Unpacked are different types.

    Definition Classes
    ProductNodeShapeShape
  8. def buildValue(elems: IndexedSeq[Any]): C

    Permalink

    Build a record value represented by this Shape from its element values.

    Build a record value represented by this Shape from its element values.

    Definition Classes
    ProductClassShapeProductNodeShape
  9. implicit val classTag: ClassTag[E]

    Permalink
  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def copy(s: Seq[Shape[_ <: ShapeLevel, _, _, _]]): ProductClassShape[E, C]

    Permalink

    Create a copy of this Shape with new element Shapes.

    Create a copy of this Shape with new element Shapes. This is used for packing Shapes recursively.

    Definition Classes
    ProductClassShapeProductNodeShape
  12. def encodeRef(value: Mixed, path: Node): Any

    Permalink

    Encode a reference into a value of this Shape.

    Encode a reference into a value of this Shape. This method may not be available for shapes where Mixed and Packed are different types.

    Definition Classes
    ProductNodeShapeShape
  13. def ensuring(cond: (ProductClassShape[E, C]) ⇒ Boolean, msg: ⇒ Any): ProductClassShape[E, C]

    Permalink
    Implicit information
    This member is added by an implicit conversion from ProductClassShape[E, C] to Ensuring[ProductClassShape[E, C]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: (ProductClassShape[E, C]) ⇒ Boolean): ProductClassShape[E, C]

    Permalink
    Implicit information
    This member is added by an implicit conversion from ProductClassShape[E, C] to Ensuring[ProductClassShape[E, C]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean, msg: ⇒ Any): ProductClassShape[E, C]

    Permalink
    Implicit information
    This member is added by an implicit conversion from ProductClassShape[E, C] to Ensuring[ProductClassShape[E, C]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: Boolean): ProductClassShape[E, C]

    Permalink
    Implicit information
    This member is added by an implicit conversion from ProductClassShape[E, C] to Ensuring[ProductClassShape[E, C]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from ProductClassShape[E, C] to StringFormat[ProductClassShape[E, C]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  21. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  22. def getElement(value: Product, idx: Int): Any

    Permalink

    Get the element value from a record value at the specified index.

    Get the element value from a record value at the specified index.

    Definition Classes
    MappedScalaProductShapeProductNodeShape
  23. def getIterator(value: Product): Iterator[Any]

    Permalink

    Get an Iterator of a record value's element values.

    Get an Iterator of a record value's element values. The default implementation repeatedly calls getElement.

    Definition Classes
    MappedScalaProductShapeProductNodeShape
  24. def hashCode(): Int

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  29. def pack(value: Mixed): Packed

    Permalink

    Convert a value of this Shape's (mixed) type to the fully packed type

    Convert a value of this Shape's (mixed) type to the fully packed type

    Definition Classes
    ProductNodeShapeShape
  30. def packedShape: Shape[FlatShapeLevel, Packed, Unpacked, Packed]

    Permalink

    Return the fully packed Shape

    Return the fully packed Shape

    Definition Classes
    ProductNodeShapeShape
  31. val shapes: Seq[Shape[_, _, _, _]]

    Permalink

    The Shapes for the product elements.

    The Shapes for the product elements.

    Definition Classes
    ProductClassShapeProductNodeShape
  32. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  33. def toBase(v: Any): ProductWrapper

    Permalink
    Definition Classes
    MappedProductShape
  34. def toMapped(v: Any): E

    Permalink
    Definition Classes
    ProductClassShapeMappedProductShape
  35. def toNode(value: Mixed): TypeMapping

    Permalink

    Return an AST Node representing a mixed value.

    Return an AST Node representing a mixed value.

    Definition Classes
    MappedProductShapeProductNodeShapeShape
  36. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. def [B](y: B): (ProductClassShape[E, C], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from ProductClassShape[E, C] to ArrowAssoc[ProductClassShape[E, C]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from MappedScalaProductShape[FlatShapeLevel, Product, C, E, C]

Inherited from MappedProductShape[FlatShapeLevel, Product, C, E, C]

Inherited from ProductNodeShape[FlatShapeLevel, Product, C, E, C]

Inherited from Shape[FlatShapeLevel, C, E, C]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from ProductClassShape[E, C] to any2stringadd[ProductClassShape[E, C]]

Inherited by implicit conversion StringFormat from ProductClassShape[E, C] to StringFormat[ProductClassShape[E, C]]

Inherited by implicit conversion Ensuring from ProductClassShape[E, C] to Ensuring[ProductClassShape[E, C]]

Inherited by implicit conversion ArrowAssoc from ProductClassShape[E, C] to ArrowAssoc[ProductClassShape[E, C]]

Ungrouped