aboutsummaryrefslogtreecommitdiffstats
path: root/utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoderObject.java
diff options
context:
space:
mode:
Diffstat (limited to 'utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoderObject.java')
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoderObject.java34
1 files changed, 12 insertions, 22 deletions
diff --git a/utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoderObject.java b/utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoderObject.java
index 7f0f0580..55f7f9d7 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoderObject.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/coder/StandardCoderObject.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * 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.
@@ -20,22 +20,30 @@
package org.onap.policy.common.utils.coder;
-import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import java.io.Serializable;
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
/**
* Object type used by the {@link StandardCoder}. Different serialization tools have
* different "standard objects". For instance, GSON uses {@link JsonElement}. This class
* wraps that object so that it can be used without exposing the object, itself.
*/
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
public class StandardCoderObject implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Data wrapped by this.
*/
- private final JsonElement data;
+ /*
+ * this should not be transient, but since it isn't serializable, we're stuck with it
+ * until there's time to address the issue
+ */
+ @Getter(AccessLevel.PROTECTED)
+ private final transient JsonElement data;
/**
* Constructs the object.
@@ -45,24 +53,6 @@ public class StandardCoderObject implements Serializable {
}
/**
- * Constructs the object.
- *
- * @param data data wrapped by this object.
- */
- protected StandardCoderObject(JsonElement data) {
- this.data = data;
- }
-
- /**
- * Gets the data wrapped by this.
- *
- * @return the data wrapped by this
- */
- protected JsonElement getData() {
- return data;
- }
-
- /**
* Gets a field's value from this object, traversing the object hierarchy.
*
* @param fields field hierarchy. These may be strings, identifying fields within the
@@ -126,7 +116,7 @@ public class StandardCoderObject implements Serializable {
return null;
}
- JsonArray array = element.getAsJsonArray();
+ var array = element.getAsJsonArray();
if (index >= array.size()) {
return null;