Formatting Code base with ktlint
[ccsdk/cds.git] / ms / controllerblueprints / modules / blueprint-core / src / main / kotlin / org / onap / ccsdk / cds / controllerblueprints / core / service / BluePrintDependencyService.kt
index fdaf25c..df3bde1 100644 (file)
@@ -18,6 +18,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
 
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
 import org.springframework.context.ApplicationContext
+import kotlin.reflect.KClass
 
 /**
  * Generic Bluepring Dependency Service, which will be used mainly in scripts.
@@ -37,11 +38,16 @@ object BluePrintDependencyService {
 
     inline fun <reified T> instance(name: String): T {
         return applicationContext.getBean(name) as? T
-                ?: throw BluePrintProcessorException("failed to get instance($name)")
+            ?: throw BluePrintProcessorException("failed to get instance($name)")
     }
 
     inline fun <reified T> instance(type: Class<T>): T {
         return applicationContext.getBean(type)
-                ?: throw BluePrintProcessorException("failed to get instance($type)")
+            ?: throw BluePrintProcessorException("failed to get instance($type)")
     }
-}
\ No newline at end of file
+
+    inline fun <reified T> instance(type: KClass<*>): T {
+        return applicationContext.getBean(type.java) as? T
+            ?: throw BluePrintProcessorException("failed to get instance($type)")
+    }
+}