aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-common
diff options
context:
space:
mode:
authorWojtek Wajerowicz <115081248+wojciech-wajerowicz-sonarsource@users.noreply.github.com>2023-12-08 12:51:20 +0100
committersonartech <sonartech@sonarsource.com>2023-12-22 20:03:02 +0000
commit8ae5701135e437ab2747d895144d8a82563051ed (patch)
tree68f001d671db4002dc30fd91f929872369f75f93 /server/sonar-webserver-common
parent8ca93afc90cd2d3ccd149f270b6b887cb1668d2a (diff)
downloadsonarqube-8ae5701135e437ab2747d895144d8a82563051ed.tar.gz
sonarqube-8ae5701135e437ab2747d895144d8a82563051ed.zip
SONAR-21121 Add POST /dop-translation/gitlab-configurations/
Diffstat (limited to 'server/sonar-webserver-common')
-rw-r--r--server/sonar-webserver-common/src/main/java/org/sonar/server/common/UpdatedValue.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/UpdatedValue.java b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/UpdatedValue.java
index 7941773c378..10f3d8783c5 100644
--- a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/UpdatedValue.java
+++ b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/UpdatedValue.java
@@ -19,10 +19,10 @@
*/
package org.sonar.server.common;
+import javax.annotation.Nullable;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Function;
-import javax.annotation.Nullable;
public class UpdatedValue<T> {
final T value;
@@ -77,4 +77,12 @@ public class UpdatedValue<T> {
public int hashCode() {
return Objects.hash(value, isDefined);
}
+
+ public T orElse(@Nullable T defaultValue) {
+ if (isDefined) {
+ return value;
+ } else {
+ return defaultValue;
+ }
+ }
}