summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-03-26 16:21:06 -0400
committerMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-03-27 13:25:41 -0400
commitfe521ab3fc62a2dc66bda6710885b8160daf21c1 (patch)
tree377db85c7d4f231d8ec93632d2306739c5f5d236 /ms/controllerblueprints
parentc3811effed948926f8d94615df7530c99d490092 (diff)
Improve Rest Service API
Change-Id: I4addb046f5e20f36f0c5d810bc547b02a70d4c17 Issue-ID: CCSDK-1137 Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints')
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt10
1 files changed, 9 insertions, 1 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
index 7ac79e2f1..7b5f181da 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
@@ -1,6 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Modifications Copyright © 2018-2019 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ import kotlinx.coroutines.withContext
import org.apache.commons.io.IOUtils
import org.onap.ccsdk.cds.controllerblueprints.core.*
import java.io.File
+import java.io.InputStream
import java.nio.charset.Charset
/**
@@ -42,10 +43,17 @@ class JacksonUtils {
inline fun <reified T : Any> readValue(content: String): T =
objectMapper.readValue(content, T::class.java)
+ inline fun <reified T : Any> readValue(stream: InputStream): T =
+ objectMapper.readValue(stream, T::class.java)
+
fun <T> readValue(content: String, valueType: Class<T>): T? {
return objectMapper.readValue(content, valueType)
}
+ fun <T> readValue(stream: InputStream, valueType: Class<T>): T? {
+ return objectMapper.readValue(stream, valueType)
+ }
+
fun <T> readValue(node: JsonNode, valueType: Class<T>): T? {
return objectMapper.treeToValue(node, valueType)
}