Moves type to the when clause
This commit is contained in:
+2
-3
@@ -31,15 +31,14 @@ class MessageDeserializer : StdDeserializer<Message>(Message::class.java) {
|
||||
override fun deserialize(
|
||||
jp: JsonParser,
|
||||
ctxt: DeserializationContext,
|
||||
): Message? {
|
||||
): Message {
|
||||
// Expect to start with a JSON array token
|
||||
if (jp.currentToken != JsonToken.START_ARRAY) {
|
||||
ctxt.reportWrongTokenException(this, JsonToken.START_ARRAY, "Expected START_ARRAY token")
|
||||
}
|
||||
|
||||
val type = jp.nextTextValue()
|
||||
val message =
|
||||
when (type) {
|
||||
when (val type = jp.nextTextValue()) {
|
||||
EventMessage.LABEL -> {
|
||||
val subId = jp.nextTextValue()
|
||||
jp.nextToken()
|
||||
|
||||
+2
-3
@@ -35,15 +35,14 @@ class CommandDeserializer : StdDeserializer<Command>(Command::class.java) {
|
||||
override fun deserialize(
|
||||
jp: JsonParser,
|
||||
ctxt: DeserializationContext,
|
||||
): Command? {
|
||||
): Command {
|
||||
// Expect to start with a JSON array token
|
||||
if (jp.currentToken != JsonToken.START_ARRAY) {
|
||||
ctxt.reportWrongTokenException(this, JsonToken.START_ARRAY, "Expected START_ARRAY token")
|
||||
}
|
||||
|
||||
val type = jp.nextTextValue()
|
||||
val message =
|
||||
when (type) {
|
||||
when (val type = jp.nextTextValue()) {
|
||||
ReqCmd.LABEL -> {
|
||||
val subId = jp.nextTextValue()
|
||||
val filters = mutableListOf<Filter>()
|
||||
|
||||
Reference in New Issue
Block a user