diff options
author | Jim Hahn <jrh3@att.com> | 2021-06-17 16:54:20 -0400 |
---|---|---|
committer | Ajith Sreekumar <ajith.sreekumar@bell.ca> | 2021-06-21 09:19:17 +0000 |
commit | 417e292dbaff7c30f86780e20da5fc95b108032a (patch) | |
tree | e34cf7ed3a8e10fe2bd185fdab8d53543d721aa3 /models-base | |
parent | 1ada3a6368f340df653886c4229b192ce7a5fc35 (diff) |
Use lombok for events, base, dao
Issue-ID: POLICY-3396
Change-Id: I7b37efc13a25e0e27d63a85a3ee291e91a4e1682
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-base')
6 files changed, 19 insertions, 40 deletions
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java index 2357ec00d..8afcaa159 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java @@ -23,6 +23,8 @@ package org.onap.policy.models.base; import java.io.Serializable; import java.util.List; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import lombok.NonNull; /** @@ -30,17 +32,11 @@ import lombok.NonNull; * and interfaces on all concepts that are sub-classes of this class. */ +@NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class PfConcept extends Validated implements Serializable, Comparable<PfConcept> { private static final long serialVersionUID = -7434939557282697490L; /** - * Default constructor. - */ - protected PfConcept() { - // Default Constructor - } - - /** * Copy constructor. * * @param copyConcept the concept to copy from diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptGetterImpl.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptGetterImpl.java index 3c186bbf8..fa1bbb4e7 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptGetterImpl.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptGetterImpl.java @@ -24,6 +24,7 @@ package org.onap.policy.models.base; import java.util.NavigableMap; import java.util.Set; import java.util.TreeSet; +import lombok.AllArgsConstructor; import org.onap.policy.common.utils.validation.Assertions; /** @@ -31,19 +32,12 @@ import org.onap.policy.common.utils.validation.Assertions; * * @param <C> the type of concept on which the interface implementation is applied. */ +@AllArgsConstructor public class PfConceptGetterImpl<C> implements PfConceptGetter<C> { // The map from which to get concepts private final NavigableMap<PfConceptKey, C> conceptMap; - /** - * Constructor that sets the concept map on which the getter methods in the interface will operate.. - * - * @param conceptMap the concept map on which the method will operate - */ - public PfConceptGetterImpl(final NavigableMap<PfConceptKey, C> conceptMap) { - this.conceptMap = conceptMap; - } @Override public C get(final PfConceptKey conceptKey) { diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java index d200a693a..98b67819e 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications 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. @@ -26,6 +26,7 @@ import javax.persistence.Embeddable; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; +import lombok.ToString; import org.onap.policy.common.parameters.annotations.Pattern; import org.onap.policy.common.utils.validation.Assertions; @@ -40,6 +41,7 @@ import org.onap.policy.common.utils.validation.Assertions; @Embeddable @Getter @EqualsAndHashCode(callSuper = false) +@ToString public class PfConceptKey extends PfKeyImpl { private static final long serialVersionUID = 8932717618579392561L; @@ -102,9 +104,4 @@ public class PfConceptKey extends PfKeyImpl { public static final PfConceptKey getNullKey() { return new PfConceptKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION); } - - @Override - public String toString() { - return "PfConceptKey(name=" + getName() + ", version=" + getVersion() + ")"; - } } diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfKey.java index 4b7f8cf95..949598828 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfKey.java @@ -21,12 +21,15 @@ package org.onap.policy.models.base; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import lombok.NonNull; /** * The key uniquely identifies every entity in the system. This class is an abstract class to give a common parent for * all key types in the system. */ +@NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class PfKey extends PfConcept { private static final long serialVersionUID = 6281159885962014041L; @@ -68,13 +71,6 @@ public abstract class PfKey extends PfConcept { } /** - * Default constructor. - */ - protected PfKey() { - super(); - } - - /** * Copy constructor. * * @param copyConcept the concept to copy from diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java b/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java index 7353915b9..860288b8e 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java @@ -24,6 +24,8 @@ package org.onap.policy.models.base; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javax.ws.rs.core.Response; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import lombok.NonNull; /** @@ -37,18 +39,12 @@ import lombok.NonNull; * exist in Policy Framework (particularly the engine) at any time. Of course the model in a JVM can be changed at any * time provided all users of the model are stopped and restarted in an orderly manner. */ -public abstract class PfModelService { +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class PfModelService { // The map holding the models private static Map<String, PfConcept> modelMap = new ConcurrentHashMap<>(); /** - * This class is an abstract static class that cannot be extended. - */ - private PfModelService() { - // Default constructor - } - - /** * Register a model with the model service. * * @param <M> the generic type diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java b/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java index 6a119d6c4..6f93010bb 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2021 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications 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. @@ -30,6 +30,8 @@ import java.util.Map.Entry; import java.util.function.Function; import java.util.stream.Collectors; import javax.ws.rs.core.Response; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; @@ -38,10 +40,8 @@ import org.apache.commons.collections4.MapUtils; * * @author Liam Fallon (liam.fallon@est.tech) */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) public final class PfUtils { - private PfUtils() { - // Cannot be subclassed - } /** * Compare two objects using their equals methods, nulls are allowed. |