package mapper
Provides machinery for mapping Cassandra tables to user defined Scala classes or tuples. The main class in this package is mapper.ColumnMapper responsible for matching Scala object's properties with Cassandra column names.
- Alphabetic
- By Inheritance
- mapper
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
trait
ColumnMapForReading extends Serializable
A column map for reading objects from Cassandra.
A column map for reading objects from Cassandra. Describes object's constructor and setters.
-
trait
ColumnMapForWriting extends Serializable
A column map for saving objects to Cassandra.
A column map for saving objects to Cassandra. Lists available getters.
-
trait
ColumnMapper[T] extends AnyRef
Produces ColumnMapForReading or ColumnMapForWriting objects that map class
T
properties to columns in a given Cassandra table.Produces ColumnMapForReading or ColumnMapForWriting objects that map class
T
properties to columns in a given Cassandra table.You can associate a custom
ColumnMapper
object with any of your classes by providing an implicitColumnMapper
in the companion object of the mapped class:CREATE TABLE kv(key int primary key, value text);
case class KeyValue(k: Int, v: String) object KeyValue { implicit val columnMapper = new DefaultColumnMapper[KeyValue](Map("k" -> "key", "v" -> "value")) }
-
class
DefaultColumnMapper[T] extends ColumnMapper[T]
A ColumnMapper that assumes camel case naming convention for property accessors and constructor names and underscore naming convention for column names.
A ColumnMapper that assumes camel case naming convention for property accessors and constructor names and underscore naming convention for column names.
Example mapping:
case class User( login: String, // mapped to "login" column emailAddress: String // mapped to "email_address" column emailAddress2: String // mapped to "email_address_2" column )
Additionally, it is possible to name columns exactly the same as property names (case-sensitive):
case class TaxPayer( TIN: String // mapped to "TIN" column )
-
class
GettableDataToMappedTypeConverter[T] extends TypeConverter[T]
Converts a
GettableData
object representing a table row or a UDT value to a tuple or a case class object using the givenColumnMapper
. - class JavaBeanColumnMapper[T] extends ReflectionColumnMapper[T]
-
trait
LowPriorityColumnMapper extends AnyRef
Provides implicit ColumnMapper used for mapping all non-tuple classes.
-
class
PropertyExtractor[T] extends Serializable
Extracts values from fields of an object.
- abstract class ReflectionColumnMapper[T] extends ColumnMapper[T]
- case class SimpleColumnMapForReading(constructor: Seq[ColumnRef], setters: Map[String, ColumnRef], allowsNull: Boolean = false) extends ColumnMapForReading with Product with Serializable
- case class SimpleColumnMapForWriting(getters: Map[String, ColumnRef]) extends ColumnMapForWriting with Product with Serializable
- class TupleColumnMapper[T] extends ColumnMapper[T]
Value Members
-
object
ColumnMapper extends LowPriorityColumnMapper
Provides implicit ColumnMapper objects used for mapping tuples.
- object ColumnMapperConvention
- object DefaultColumnMapper
- object JavaBeanColumnMapper
- object MappedToGettableDataConverter extends Logging
- object PropertyExtractor extends Serializable