Created
February 28, 2013 10:26
-
-
Save mandubian/5055738 to your computer and use it in GitHub Desktop.
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
Class Rectangle | |
val rectWrites = ( | |
(__ \ 'width).write[Long] and | |
(__ \ 'height).write[Long] and | |
(__ \ 'x).write[Long] and | |
(__ \ 'y).write[Long] | |
)( (r: Rectangle) => (r.width, r.height, r.x, r.y) ) |
aha we can rewrite all awt* writers!
implicit val ColorWrites = Writes[Color] { c =>
JsString(
"#"+
Integer.toHexString(c.getRed())+
Integer.toHexString(c.getGreen())+
Integer.toHexString(c.getBlue())
)
}
implicit val ColorWrites = Writes[Color] { c =>
JsString("#%02x%02x%02x" format (c.getRed, c.getGreen, c.getBlue))
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
aha we can rewrite all awt* writers!