summaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
authorsheetalm <sheetal.mudholkar@amdocs.com>2017-12-12 10:18:53 +0530
committersheetalm <sheetal.mudholkar@amdocs.com>2017-12-12 10:31:24 +0530
commitc8983a6f979ede3817f060cfa5f93ee40a75fcf4 (patch)
tree1196040c498e85e18db870884a623683756cb526 /openecomp-be
parentc2a8e0e83e1ac776a987d52cc97c0aa9c5c35954 (diff)
Fixed sonar issues - AbstractComponentFactory
Declaring functional interface. Removing unused code. Correct copyright Change-Id: I749929be60eb0e87b6c4b12b30c211bf778af331 Issue-ID: SDC-343 Signed-off-by: sheetalm <sheetal.mudholkar@amdocs.com>
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/api/AbstractComponentFactory.java34
1 files changed, 5 insertions, 29 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/api/AbstractComponentFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/api/AbstractComponentFactory.java
index 9cd7749f55..102c6db572 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/api/AbstractComponentFactory.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/api/AbstractComponentFactory.java
@@ -1,9 +1,6 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -15,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.core.factory.api;
@@ -36,6 +32,7 @@ public abstract class AbstractComponentFactory<I> extends AbstractFactory<I> {
InitializationHelper.registerFactoryMapping(registry);
}
+ @FunctionalInterface
interface Registry {
void register(String factory, String impl);
}
@@ -55,22 +52,16 @@ public abstract class AbstractComponentFactory<I> extends AbstractFactory<I> {
private InitializationHelper() {
}
- static synchronized boolean registerFactoryMapping(Registry registry) {
-
- boolean done = !isRegistered;
-
+ static synchronized void registerFactoryMapping(Registry registry) {
if (!isRegistered) {
registerFactoryMappingImpl(registry);
isRegistered = true;
}
-
- return done;
}
private static void registerFactoryMappingImpl(Registry registry) {
Map<String, String> factoryMap = FactoryConfig.getFactoriesMap();
- try {
for (Map.Entry<String, String> entry : factoryMap.entrySet()) {
String abstractClassName = entry.getKey();
String concreteTypeName = entry.getValue();
@@ -82,23 +73,8 @@ public abstract class AbstractComponentFactory<I> extends AbstractFactory<I> {
.withCategory(ErrorCategory.SYSTEM).build());
}
-
registry.register(abstractClassName, concreteTypeName);
}
- } catch (RuntimeException exception) {
- throw exception;
- } catch (Exception exception) {
- throw new RuntimeException(exception);
- }
- }
-
- @SuppressWarnings("unchecked")
- private static <T> Class<T> unsecureCast(Class<?> cls) {
- return (Class<T>) cls;
- }
-
- private static String nameOf(Class<?> clazz) {
- return (clazz != null) ? clazz.getName() : "null";
}
}