Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a type conversion from a JUG UUID to Array[Byte]
- Loading branch information
1 parent
b1c9853
commit 306d884
Showing
1 changed file
with
5 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
package com.protose.telephos | ||
|
||
object TypeConversions { | ||
type ColumnMap = Map[Array[Byte], Array[Byte]] | ||
import org.safehaus.uuid.UUID | ||
|
||
object TypeConversions { | ||
implicit def string2ByteArray(string: String): Array[Byte] = string.getBytes | ||
implicit def map2ColumnMap[A <% Array[Byte], B <% Array[Byte]](map: Map[A, B]): | ||
ColumnMap = { | ||
Map[Array[Byte], Array[Byte]] = { | ||
map.foldLeft(Map[Array[Byte], Array[Byte]]()) { case (map, (k, v)) => | ||
val tuple = (k: Array[Byte], v: Array[Byte]) | ||
map + tuple | ||
} | ||
} | ||
|
||
implicit def uuid2ByteArray(uuid: UUID): Array[Byte] = uuid.asByteArray | ||
} |