Created
July 7, 2014 19:25
-
-
Save cokeSchlumpf/bbad848d4c44aadd7fa7 to your computer and use it in GitHub Desktop.
Slick Column Mapper for wellnr commons Enumerations
This file contains hidden or 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
/** | |
* Returns a mapper for an enumeration. | |
* | |
* @param enumeration | |
* The Enumeration object. | |
* @tparam ENUM | |
* The type of the enumeration. | |
* @return | |
* The mapper column mapper for the enumeration. | |
*/ | |
def enumColumnType[ENUM <: EnumerationCapabilities](enumeration: ENUM)(implicit classTag: ClassTag[enumeration.type#ENUM_TYPE]) = | |
MappedColumnType.base[enumeration.type#ENUM_TYPE, String]( | |
enumValue => enumeration.asString(enumValue), | |
stringValue => enumeration.forString(stringValue)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment