Conveniently construct a format for a case class
type.
Conveniently construct a format for a case class
type.
For example:
case class StorageKey(distributionKey: String, sortKey: String) object StorageKey { implicit val stringKeyFormat: StringKeyFormat[StorageKey] = StringKeyFormat.caseClassFormat((apply _).tupled, unapply) }
Format T by first converting it to U.
Conveniently construct a format for an empty class.
Conveniently construct a format for an empty class.
This should NEVER be used for non-empty case classes.
For example:
case object Marker { implicit val stringKeyFormat: StringKeyFormat[Marker.type] = StringKeyFormat.emptyFormat("marker", Marker) }
Serializes T with a prefix so its string form is easily identifiable.
Serializes T with a prefix so its string form is easily identifiable.
For example:
case class AuthenticatedUserId(id: Int) object AuthenticatedUserId { implicit val stringKeyFormat: StringKeyFormat[AuthenticatedUserId] = { StringKeyFormat.prefixFormat( "authenticatedUser", StringKeyFormat.caseClass((apply _).tupled, unapply)) } }
This format will convert AuthenticatedUserId(1)
to "authenticatedUser~1"
.