import java.util.Objects;
import java.util.UUID;
import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.onap.aai.champcore.event.envelope.util.GsonUtil;
-import com.google.gson.Gson;
-import com.google.gson.annotations.SerializedName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
public class ChampEventHeader {
}
}
- @SerializedName("request-id")
+ @JsonProperty("request-id")
private String requestId;
private String timestamp;
- @SerializedName("source-name")
+ @JsonProperty("source-name")
private String sourceName;
- @SerializedName("event-type")
+ @JsonProperty("event-type")
private String eventType;
- @SerializedName("validation-entity-type")
+ @JsonProperty("validation-entity-type")
private String validationEntityType;
- @SerializedName("validation-top-entity-type")
+ @JsonProperty("validation-top-entity-type")
private String validationTopEntityType;
- @SerializedName("entity-link")
+ @JsonProperty("entity-link")
private String entityLink;
- private static final Gson gson = GsonUtil.createGson();
-
public static class Builder {
private final EventType eventType;
* @return a JSON format string representation of this object.
*/
public String toJson() {
- return gson.toJson(this);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+
+ try {
+ return mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ return "Unmarshallable: " + e.getMessage();
+ }
}
///////////////////////////////////////////////////////////////////////////