summaryrefslogtreecommitdiffstats
path: root/policy-utils/src/main/java/org/onap/policy/drools/utils/Reference.java
diff options
context:
space:
mode:
Diffstat (limited to 'policy-utils/src/main/java/org/onap/policy/drools/utils/Reference.java')
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/Reference.java26
1 files changed, 10 insertions, 16 deletions
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/Reference.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/Reference.java
index 7755177e..c21fe316 100644
--- a/policy-utils/src/main/java/org/onap/policy/drools/utils/Reference.java
+++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/Reference.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018, 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,27 +20,21 @@
package org.onap.policy.drools.utils;
+import lombok.AllArgsConstructor;
+
/**
* Reference to an object. Used within functional methods, where thread-safety is not
* required.
- *
+ *
* @param <T> type of object contained within the reference
*/
+@AllArgsConstructor
public class Reference<T> {
private T value;
/**
- * Constructor.
- *
- * @param value value
- */
- public Reference(T value) {
- this.value = value;
- }
-
- /**
* Get the value.
- *
+ *
* @return the current value
*/
public final T get() {
@@ -49,7 +43,7 @@ public class Reference<T> {
/**
* Sets the reference to point to a new value.
- *
+ *
* @param newValue the new value
*/
public final void set(T newValue) {
@@ -58,7 +52,7 @@ public class Reference<T> {
/**
* Sets the value to a new value, if the value is currently the same as the old value.
- *
+ *
* @param oldValue old value
* @param newValue new value
* @return {@code true} if the value was updated, {@code false} otherwise