-
-
Save attribyte/0a0ee82334a6178400ea 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
trait KinjaMessage extends java.io.Serializable { | |
def toByteArray: Array[Byte] | |
} | |
trait NameValueMessage extends KinjaMessage { | |
def toNameValuePairs: TraversableOnce[(String, Any)] | |
override def toByteArray: Array[Byte] = { | |
val nvBuilder = NameValueSeq.newBuilder() | |
toNameValuePairs.foreach(nv => { | |
add(nv, nvBuilder) | |
}) | |
nvBuilder.build().toByteArray | |
} | |
} | |
trait KinjaMessageMaterializer { | |
def fromByteArray(bytes: Array[Byte]): KinjaMessage | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment