X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=mod2%2Fhelm-generator%2Fhelmchartgenerator-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdcaegen2%2Fplatform%2Fhelmchartgenerator%2FUtils.java;h=a2528865bcf4f39cd3f88f79d070a4dafba43074;hb=a494a322554924f6f9c3d6cc79240f54d3a8da0b;hp=83c67b1655a4397f460d7e0dcdb9c071d0c45ad5;hpb=0d1b8727a44b0add010b79e495b799e538057d20;p=dcaegen2%2Fplatform.git diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/Utils.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/Utils.java index 83c67b1..a252886 100644 --- a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/Utils.java +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/Utils.java @@ -21,6 +21,7 @@ package org.onap.dcaegen2.platform.helmchartgenerator; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; +import org.springframework.stereotype.Component; import java.io.File; import java.io.IOException; @@ -33,13 +34,12 @@ import java.util.Map; * @author Dhrumin Desai */ @Slf4j +@Component public class Utils { - private static final ObjectMapper MAPPER = new ObjectMapper(); + private final ObjectMapper MAPPER = new ObjectMapper(); - private Utils() {} - - public static T deserializeJsonFileToModel(String filePath, Class modelClass) { + public T deserializeJsonFileToModel(String filePath, Class modelClass) { return deserializeJsonFileToModel(new File(filePath), modelClass); } @@ -49,7 +49,7 @@ public class Utils { * @param modelClass target model class for mapping * @return mapped model instance */ - public static T deserializeJsonFileToModel(File file, Class modelClass) { + public T deserializeJsonFileToModel(File file, Class modelClass) { try { return MAPPER.readValue(file, modelClass); } catch (IOException e) { @@ -63,7 +63,7 @@ public class Utils { * @param srcLocation * @return */ - public static File cloneFileToTempLocation(String srcLocation) { + public File cloneFileToTempLocation(String srcLocation) { File cloneLocation = null; try { Path tempRootDir = Files.createTempDirectory("chart"); @@ -81,7 +81,7 @@ public class Utils { * deletes dir / file from temp location of OS * @param dir dir to be deleted */ - public static void deleteTempFileLocation(File dir) { + public void deleteTempFileLocation(File dir) { try { FileUtils.deleteDirectory(dir); } catch (IOException e) { @@ -95,7 +95,7 @@ public class Utils { * @param key a key * @param value a value */ - public static void putIfNotNull(Map map, String key, Object value){ + public void putIfNotNull(Map map, String key, Object value){ if(value != null){ map.put(key, value); }