diff --git a/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/Serializer.java b/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/JsonSerializer.java similarity index 94% rename from disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/Serializer.java rename to disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/JsonSerializer.java index c028d29da..22e52a198 100644 --- a/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/Serializer.java +++ b/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/JsonSerializer.java @@ -8,12 +8,12 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; -public final class Serializer { +public final class JsonSerializer { private static final DslJson dslJson = new DslJson<>(Settings.basicSetup().skipDefaultValues(true)); - private Serializer() {} + private JsonSerializer() {} public static JsonReader.ReadObject tryFindReader(Class manifest) { return dslJson.tryFindReader(manifest); diff --git a/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/converters/MetricDataJsonConverter.java b/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/converters/MetricDataJsonConverter.java index 44d742070..ef8549e6e 100644 --- a/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/converters/MetricDataJsonConverter.java +++ b/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/converters/MetricDataJsonConverter.java @@ -3,7 +3,7 @@ import com.dslplatform.json.JsonConverter; import com.dslplatform.json.JsonReader; import com.dslplatform.json.JsonWriter; -import io.opentelemetry.contrib.disk.buffer.internal.serialization.Serializer; +import io.opentelemetry.contrib.disk.buffer.internal.serialization.JsonSerializer; import io.opentelemetry.contrib.disk.buffer.internal.serialization.models.metrics.MetricDataJson; import io.opentelemetry.contrib.disk.buffer.internal.serialization.models.metrics.data.ExponentialHistogram; import io.opentelemetry.contrib.disk.buffer.internal.serialization.models.metrics.data.Gauge; @@ -101,7 +101,7 @@ public static void write(JsonWriter writer, MetricDataJson value) { private static JsonReader.ReadObject getReader(Class type) { JsonReader.ReadObject reader = READERS.get(type); if (reader == null) { - reader = Serializer.tryFindReader(type); + reader = JsonSerializer.tryFindReader(type); READERS.put(type, reader); } @@ -111,7 +111,7 @@ private static JsonReader.ReadObject getReader(Class type) { private static JsonWriter.WriteObject getWriter(Class type) { JsonWriter.WriteObject writer = WRITERS.get(type); if (writer == null) { - writer = Serializer.tryFindWriter(type); + writer = JsonSerializer.tryFindWriter(type); WRITERS.put(type, writer); } diff --git a/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/serializers/LogRecordDataSerializer.java b/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/serializers/LogRecordDataSerializer.java index 869a34cab..d1ee99a16 100644 --- a/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/serializers/LogRecordDataSerializer.java +++ b/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/serializers/LogRecordDataSerializer.java @@ -1,7 +1,7 @@ package io.opentelemetry.contrib.disk.buffer.internal.serialization.serializers; import io.opentelemetry.contrib.disk.buffer.internal.serialization.mapping.logs.ResourceLogsDataMapper; -import io.opentelemetry.contrib.disk.buffer.internal.serialization.Serializer; +import io.opentelemetry.contrib.disk.buffer.internal.serialization.JsonSerializer; import io.opentelemetry.contrib.disk.buffer.internal.serialization.models.logs.ResourceLogsData; import io.opentelemetry.sdk.logs.data.LogRecordData; import java.io.IOException; @@ -23,7 +23,7 @@ static LogRecordDataSerializer get() { @Override public byte[] serialize(List logRecordData) { try { - return Serializer.serialize(ResourceLogsDataMapper.INSTANCE.toJsonDto(logRecordData)); + return JsonSerializer.serialize(ResourceLogsDataMapper.INSTANCE.toJsonDto(logRecordData)); } catch (IOException e) { throw new IllegalArgumentException(e); } @@ -33,7 +33,7 @@ public byte[] serialize(List logRecordData) { public List deserialize(byte[] source) { try { return ResourceLogsDataMapper.INSTANCE.fromJsonDto( - Serializer.deserialize(ResourceLogsData.class, source)); + JsonSerializer.deserialize(ResourceLogsData.class, source)); } catch (IOException e) { throw new IllegalArgumentException(e); } diff --git a/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/serializers/MetricDataSerializer.java b/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/serializers/MetricDataSerializer.java index dedd7a902..fa2f63837 100644 --- a/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/serializers/MetricDataSerializer.java +++ b/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/serializers/MetricDataSerializer.java @@ -1,7 +1,7 @@ package io.opentelemetry.contrib.disk.buffer.internal.serialization.serializers; import io.opentelemetry.contrib.disk.buffer.internal.serialization.mapping.metrics.ResourceMetricsDataMapper; -import io.opentelemetry.contrib.disk.buffer.internal.serialization.Serializer; +import io.opentelemetry.contrib.disk.buffer.internal.serialization.JsonSerializer; import io.opentelemetry.contrib.disk.buffer.internal.serialization.models.metrics.ResourceMetricsData; import io.opentelemetry.sdk.metrics.data.MetricData; import java.io.IOException; @@ -23,7 +23,7 @@ static MetricDataSerializer get() { @Override public byte[] serialize(List metricData) { try { - return Serializer.serialize(ResourceMetricsDataMapper.INSTANCE.toJsonDto(metricData)); + return JsonSerializer.serialize(ResourceMetricsDataMapper.INSTANCE.toJsonDto(metricData)); } catch (IOException e) { throw new IllegalArgumentException(e); } @@ -33,7 +33,7 @@ public byte[] serialize(List metricData) { public List deserialize(byte[] source) { try { return ResourceMetricsDataMapper.INSTANCE.fromJsonDto( - Serializer.deserialize(ResourceMetricsData.class, source)); + JsonSerializer.deserialize(ResourceMetricsData.class, source)); } catch (IOException e) { throw new IllegalArgumentException(e); } diff --git a/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/serializers/SpanDataSerializer.java b/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/serializers/SpanDataSerializer.java index 9d038c5ec..33e565eff 100644 --- a/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/serializers/SpanDataSerializer.java +++ b/disk-buffer/src/main/java/io/opentelemetry/contrib/disk/buffer/internal/serialization/serializers/SpanDataSerializer.java @@ -1,7 +1,7 @@ package io.opentelemetry.contrib.disk.buffer.internal.serialization.serializers; import io.opentelemetry.contrib.disk.buffer.internal.serialization.mapping.spans.ResourceSpansDataMapper; -import io.opentelemetry.contrib.disk.buffer.internal.serialization.Serializer; +import io.opentelemetry.contrib.disk.buffer.internal.serialization.JsonSerializer; import io.opentelemetry.contrib.disk.buffer.internal.serialization.models.spans.ResourceSpansData; import io.opentelemetry.sdk.trace.data.SpanData; import java.io.IOException; @@ -23,7 +23,7 @@ static SpanDataSerializer get() { @Override public byte[] serialize(List spanData) { try { - return Serializer.serialize(ResourceSpansDataMapper.INSTANCE.toJsonDto(spanData)); + return JsonSerializer.serialize(ResourceSpansDataMapper.INSTANCE.toJsonDto(spanData)); } catch (IOException e) { throw new IllegalArgumentException(e); } @@ -33,7 +33,7 @@ public byte[] serialize(List spanData) { public List deserialize(byte[] source) { try { return ResourceSpansDataMapper.INSTANCE.fromJsonDto( - Serializer.deserialize(ResourceSpansData.class, source)); + JsonSerializer.deserialize(ResourceSpansData.class, source)); } catch (IOException e) { throw new IllegalArgumentException(e); } diff --git a/disk-buffer/src/test/java/io/opentelemetry/contrib/disk/buffer/testutils/BaseJsonSerializationTest.java b/disk-buffer/src/test/java/io/opentelemetry/contrib/disk/buffer/testutils/BaseJsonSerializationTest.java index c489113a5..e06930517 100644 --- a/disk-buffer/src/test/java/io/opentelemetry/contrib/disk/buffer/testutils/BaseJsonSerializationTest.java +++ b/disk-buffer/src/test/java/io/opentelemetry/contrib/disk/buffer/testutils/BaseJsonSerializationTest.java @@ -1,12 +1,12 @@ package io.opentelemetry.contrib.disk.buffer.testutils; -import io.opentelemetry.contrib.disk.buffer.internal.serialization.Serializer; +import io.opentelemetry.contrib.disk.buffer.internal.serialization.JsonSerializer; import java.io.IOException; public abstract class BaseJsonSerializationTest { protected byte[] serialize(T item) { try { - return Serializer.serialize(item); + return JsonSerializer.serialize(item); } catch (IOException e) { throw new RuntimeException(e); } @@ -14,7 +14,7 @@ protected byte[] serialize(T item) { protected T deserialize(byte[] json) { try { - return Serializer.deserialize(getTargetClass(), json); + return JsonSerializer.deserialize(getTargetClass(), json); } catch (IOException e) { throw new RuntimeException(e); }