diff options
author | 2017-12-27 14:42:51 +0530 | |
---|---|---|
committer | 2017-12-27 11:45:34 +0000 | |
commit | f00a3cc3452f6d15ac107d7e2c199b02e6338329 (patch) | |
tree | 9bd4b9ffa25bf83ed35c793ad6021c43fcf1363a /common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java | |
parent | 53c101d783b944da0323faeea46f13477cb5acff (diff) |
Sonar fixes for module - Configuration mgmt api
1. Fixed major sonar violations configuration management api module
Change-Id: I83863213e35cf092ffd1c1ff84f408318d5ce8e9
Issue-ID: SDC-343
Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
Diffstat (limited to 'common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java')
-rw-r--r-- | common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java index 428d9ee233..3b64fe71a9 100644 --- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java +++ b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java @@ -83,14 +83,8 @@ public class DynamicConfiguration<T> { "Only Wrapper classes like Integer, Long, Double, " + "Boolean etc including String are supported."); } - DynamicConfiguration<List<K>> dynamicConfiguration = new DynamicConfiguration<>(); - dynamicConfiguration.tenant = tenant; - dynamicConfiguration.namespace = namespace; - dynamicConfiguration.key = key; - dynamicConfiguration.clazz = getArrayClass(clazz); - dynamicConfiguration.defaultValue = Arrays.asList(defaultValue); - dynamicConfiguration.configuration = configuration; - return dynamicConfiguration; + return getDynamicConfiguration(tenant, namespace, key, getArrayClass(clazz), + Arrays.asList(defaultValue), configuration); } /** @@ -100,28 +94,38 @@ public class DynamicConfiguration<T> { * @return the array class */ public static Class getArrayClass(Class clazz) { + Class arrayClass = null; switch (clazz.getName()) { case "java.lang.Byte": - return Byte[].class; + arrayClass = Byte[].class; + break; case "java.lang.Short": - return Short[].class; + arrayClass = Short[].class; + break; case "java.lang.Integer": - return Integer[].class; + arrayClass = Integer[].class; + break; case "java.lang.Long": - return Long[].class; + arrayClass = Long[].class; + break; case "java.lang.Float": - return Float[].class; + arrayClass = Float[].class; + break; case "java.lang.Double": - return Double[].class; + arrayClass = Double[].class; + break; case "java.lang.Boolean": - return Boolean[].class; + arrayClass = Boolean[].class; + break; case "java.lang.Character": - return Character[].class; + arrayClass = Character[].class; + break; case "java.lang.String": - return String[].class; + arrayClass = String[].class; + break; default: } - return null; + return arrayClass; } /** |