diff options
author | Dan Timoney <dtimoney@att.com> | 2019-03-29 13:00:03 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-03-29 13:00:03 +0000 |
commit | 0dfd513f0210324d8a2c4295b8c6c4746298086f (patch) | |
tree | 5bb1ef5a744081bff9603c4891037421b3e22b08 /ms/controllerblueprints/modules/blueprint-core | |
parent | 01e8fdaebd90432ebec9ac98a0027d8504673ed7 (diff) | |
parent | fe521ab3fc62a2dc66bda6710885b8160daf21c1 (diff) |
Merge "Improve Rest Service API"
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-core')
-rw-r--r-- | ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt | 10 |
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) } |