aboutsummaryrefslogtreecommitdiffstats
path: root/utils/src/main/java/org/onap/policy/common/utils/services
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-06-17 13:02:08 -0400
committerJim Hahn <jrh3@att.com>2021-06-17 13:32:09 -0400
commitd23a8d83d67ab59dee405b29ddbc6dce6fd3c71b (patch)
tree06b350ac3004e5329e814e9f20a52e1bd088fc18 /utils/src/main/java/org/onap/policy/common/utils/services
parent435c3bd346a5f8050cc22df9df223479e5f32573 (diff)
Use lombok in policy-common utils
Issue-ID: POLICY-3394 Change-Id: I42a18c115c3ca7110f37fc0ae8aeea3f2bbffb37 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'utils/src/main/java/org/onap/policy/common/utils/services')
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/services/FeatureApiUtils.java11
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/services/Registry.java12
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java16
3 files changed, 14 insertions, 25 deletions
diff --git a/utils/src/main/java/org/onap/policy/common/utils/services/FeatureApiUtils.java b/utils/src/main/java/org/onap/policy/common/utils/services/FeatureApiUtils.java
index 332e0f67..042ee937 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/services/FeatureApiUtils.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/services/FeatureApiUtils.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,15 +23,14 @@ package org.onap.policy.common.utils.services;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Predicate;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
/**
* Utilities for use with "feature APIs".
*/
-public class FeatureApiUtils {
-
- private FeatureApiUtils() {
- // do nothing
- }
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class FeatureApiUtils {
/**
* Applies a function on each feature provider, stopping as soon as one returns true.
diff --git a/utils/src/main/java/org/onap/policy/common/utils/services/Registry.java b/utils/src/main/java/org/onap/policy/common/utils/services/Registry.java
index c3eabe8e..8765ba8b 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/services/Registry.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/services/Registry.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,8 @@ package org.onap.policy.common.utils.services;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -29,6 +31,7 @@ import org.slf4j.LoggerFactory;
* This is a simple object registry, similar in spirit to JNDI, but suitable for use in a
* stand-alone JVM.
*/
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Registry {
private static final Logger logger = LoggerFactory.getLogger(Registry.class);
@@ -40,13 +43,6 @@ public class Registry {
private Map<String, Object> name2object = new ConcurrentHashMap<>();
/**
- * Constructs the object.
- */
- private Registry() {
- super();
- }
-
- /**
* Registers an object.
*
* @param name name by which the object is known
diff --git a/utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java b/utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java
index 78fe853b..1387462f 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/services/ServiceManager.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP PAP
* ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,8 @@ package org.onap.policy.common.utils.services;
import java.util.Deque;
import java.util.Iterator;
import java.util.LinkedList;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
import org.onap.policy.common.capabilities.Startable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,6 +39,7 @@ public class ServiceManager implements Startable {
/**
* Manager name.
*/
+ @Getter
private final String name;
/**
@@ -65,10 +68,6 @@ public class ServiceManager implements Startable {
this.name = name;
}
- public String getName() {
- return name;
- }
-
/**
* Adds a pair of service actions to the manager.
*
@@ -204,16 +203,11 @@ public class ServiceManager implements Startable {
/**
* Service information.
*/
+ @AllArgsConstructor
private static class Service {
private String stepName;
private RunnableWithEx starter;
private RunnableWithEx stopper;
-
- public Service(String stepName, RunnableWithEx starter, RunnableWithEx stopper) {
- this.stepName = stepName;
- this.starter = starter;
- this.stopper = stopper;
- }
}
/*