aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2020-01-16 17:21:46 +0100
committerRobert Jaros <rjaros@finn.pl>2020-01-16 17:21:46 +0100
commitd79881420b4564a4dfb40f13d3b0623b4fbc46ad (patch)
treef92e174e693383e3446fd40db922ae3c5f2502be /kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote
parent433cd06aed92b7ae588608b45783d6173ea1d776 (diff)
downloadkvision-d79881420b4564a4dfb40f13d3b0623b4fbc46ad.tar.gz
kvision-d79881420b4564a4dfb40f13d3b0623b4fbc46ad.tar.bz2
kvision-d79881420b4564a4dfb40f13d3b0623b4fbc46ad.zip
Support for custom Decimal type in the common target
Diffstat (limited to 'kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote')
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt71
1 files changed, 53 insertions, 18 deletions
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index ac799769..6cc2b73d 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -40,12 +40,13 @@ import org.jooby.Response
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import pl.treksoft.kvision.types.*
-import kotlin.reflect.KClass
-import java.time.LocalDateTime
+import java.math.BigDecimal
import java.time.LocalDate
+import java.time.LocalDateTime
import java.time.LocalTime
import java.time.OffsetDateTime
import java.time.OffsetTime
+import kotlin.reflect.KClass
/**
@@ -67,11 +68,13 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
module.addSerializer(LocalTime::class.java, LocalTimeSerializer())
module.addSerializer(OffsetDateTime::class.java, OffsetDateTimeSerializer())
module.addSerializer(OffsetTime::class.java, OffsetTimeSerializer())
+ module.addSerializer(BigDecimal::class.java, BigDecimalSerializer())
module.addDeserializer(LocalDateTime::class.java, LocalDateTimeDeserializer())
module.addDeserializer(LocalDate::class.java, LocalDateDeserializer())
module.addDeserializer(LocalTime::class.java, LocalTimeDeserializer())
module.addDeserializer(OffsetDateTime::class.java, OffsetDateTimeDeserializer())
module.addDeserializer(OffsetTime::class.java, OffsetTimeDeserializer())
+ module.addDeserializer(BigDecimal::class.java, BigDecimalDeserializer())
this.registerModule(module)
}
var counter: Int = 0
@@ -108,8 +111,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
} catch (e: Exception) {
if (!(e is ServiceException)) LOG.error(e.message, e)
- res.send(JsonRpcResponse(id = jsonRpcRequest.id, error = e.message ?: "Error",
- exceptionType = e.javaClass.canonicalName))
+ res.send(
+ JsonRpcResponse(
+ id = jsonRpcRequest.id, error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
+ )
+ )
}
}
}.invoke(this)
@@ -148,8 +155,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
} catch (e: Exception) {
if (!(e is ServiceException)) LOG.error(e.message, e)
- res.send(JsonRpcResponse(id = jsonRpcRequest.id, error = e.message ?: "Error",
- exceptionType = e.javaClass.canonicalName))
+ res.send(
+ JsonRpcResponse(
+ id = jsonRpcRequest.id, error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
+ )
+ )
}
}
} else {
@@ -192,8 +203,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
} catch (e: Exception) {
if (!(e is ServiceException)) LOG.error(e.message, e)
- res.send(JsonRpcResponse(id = jsonRpcRequest.id, error = e.message ?: "Error",
- exceptionType = e.javaClass.canonicalName))
+ res.send(
+ JsonRpcResponse(
+ id = jsonRpcRequest.id, error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
+ )
+ )
}
}
} else {
@@ -238,8 +253,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
} catch (e: Exception) {
if (!(e is ServiceException)) LOG.error(e.message, e)
- res.send(JsonRpcResponse(id = jsonRpcRequest.id, error = e.message ?: "Error",
- exceptionType = e.javaClass.canonicalName))
+ res.send(
+ JsonRpcResponse(
+ id = jsonRpcRequest.id, error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
+ )
+ )
}
}
} else {
@@ -285,8 +304,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
} catch (e: Exception) {
if (!(e is ServiceException)) LOG.error(e.message, e)
- res.send(JsonRpcResponse(id = jsonRpcRequest.id, error = e.message ?: "Error",
- exceptionType = e.javaClass.canonicalName))
+ res.send(
+ JsonRpcResponse(
+ id = jsonRpcRequest.id, error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
+ )
+ )
}
}
} else {
@@ -334,8 +357,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
} catch (e: Exception) {
if (!(e is ServiceException)) LOG.error(e.message, e)
- res.send(JsonRpcResponse(id = jsonRpcRequest.id, error = e.message ?: "Error",
- exceptionType = e.javaClass.canonicalName))
+ res.send(
+ JsonRpcResponse(
+ id = jsonRpcRequest.id, error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
+ )
+ )
}
}
} else {
@@ -448,8 +475,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
} catch (e: Exception) {
if (!(e is ServiceException)) LOG.error(e.message, e)
- res.send(JsonRpcResponse(id = jsonRpcRequest.id, error = e.message ?: "Error",
- exceptionType = e.javaClass.canonicalName))
+ res.send(
+ JsonRpcResponse(
+ id = jsonRpcRequest.id, error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
+ )
+ )
}
}
} else {
@@ -493,8 +524,12 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
)
} catch (e: Exception) {
if (!(e is ServiceException)) LOG.error(e.message, e)
- res.send(JsonRpcResponse(id = jsonRpcRequest.id, error = e.message ?: "Error",
- exceptionType = e.javaClass.canonicalName))
+ res.send(
+ JsonRpcResponse(
+ id = jsonRpcRequest.id, error = e.message ?: "Error",
+ exceptionType = e.javaClass.canonicalName
+ )
+ )
}
}
} else {