com.datadog.api.client.UnparsedObject Maven / Gradle / Ivy
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-Present Datadog, Inc.
*/
package com.datadog.api.client;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
import java.util.Map;
@JsonSerialize(using = UnparsedObject.UnparsedObjectSerializer.class)
public class UnparsedObject {
Map data;
public UnparsedObject(Map data) {
this.data = data;
}
public static class UnparsedObjectSerializer extends StdSerializer {
public UnparsedObjectSerializer(Class t) {
super(t);
}
public UnparsedObjectSerializer() {
this(null);
}
@Override
public void serialize(UnparsedObject value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException {
jgen.writeObject(value.data);
}
}
public Map getData() {
return this.data;
}
public void setData(Map data) {
this.data = data;
}
@Override
public int hashCode() {
return data.hashCode();
}
/** Return true if this UnparsedObject object is equal to o. */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return this.data.equals(((UnparsedObject) o).data);
}
@JsonCreator
public static UnparsedObject fromValue(Map value) {
return new UnparsedObject(value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy