Skip to content

Commit

Permalink
refactor(#2933): Rename class JsonLdSerializer to CouchDbJsonSerializ…
Browse files Browse the repository at this point in the history
…er (#2934)
  • Loading branch information
tenthe authored Jun 16, 2024
1 parent 648e6be commit bc62892
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import java.lang.reflect.MalformedParameterizedTypeException;
import java.lang.reflect.Type;

public class JsonLdSerializer<T> implements JsonDeserializer<T>, JsonSerializer<T> {
public class CouchDbJsonSerializer<T> implements JsonDeserializer<T>, JsonSerializer<T> {

private static final Logger LOG = LoggerFactory.getLogger(JsonLdSerializer.class);
private static final Logger LOG = LoggerFactory.getLogger(CouchDbJsonSerializer.class);

@Override
public T deserialize(JsonElement json, Type typeOfT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static GsonBuilder getAdapterGsonBuilder() {
GsonBuilder builder = getGsonBuilder();
builder.registerTypeHierarchyAdapter(AdapterDescription.class, new AdapterSerializer());
builder.registerTypeAdapter(TransformationRuleDescription.class,
new JsonLdSerializer<TransformationRuleDescription>());
new CouchDbJsonSerializer<TransformationRuleDescription>());
// builder.registerTypeHierarchyAdapter(TransformationRuleDescription.class, new AdapterSerializer());

return builder;
Expand All @@ -82,20 +82,20 @@ public static Gson getGson() {

public static GsonBuilder getGsonBuilder() {
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(EventProperty.class, new JsonLdSerializer<EventProperty>());
builder.registerTypeAdapter(StaticProperty.class, new JsonLdSerializer<StaticProperty>());
builder.registerTypeAdapter(OutputStrategy.class, new JsonLdSerializer<OutputStrategy>());
builder.registerTypeAdapter(TransportProtocol.class, new JsonLdSerializer<TransportProtocol>());
builder.registerTypeAdapter(MappingProperty.class, new JsonLdSerializer<MappingProperty>());
builder.registerTypeAdapter(ValueSpecification.class, new JsonLdSerializer<ValueSpecification>());
builder.registerTypeAdapter(EventProperty.class, new CouchDbJsonSerializer<EventProperty>());
builder.registerTypeAdapter(StaticProperty.class, new CouchDbJsonSerializer<StaticProperty>());
builder.registerTypeAdapter(OutputStrategy.class, new CouchDbJsonSerializer<OutputStrategy>());
builder.registerTypeAdapter(TransportProtocol.class, new CouchDbJsonSerializer<TransportProtocol>());
builder.registerTypeAdapter(MappingProperty.class, new CouchDbJsonSerializer<MappingProperty>());
builder.registerTypeAdapter(ValueSpecification.class, new CouchDbJsonSerializer<ValueSpecification>());
builder.registerTypeAdapter(DataSinkType.class, new EcTypeAdapter());
builder.registerTypeAdapter(AdapterType.class, new AdapterTypeAdapter());
builder.registerTypeAdapter(Message.class, new JsonLdSerializer<Message>());
builder.registerTypeAdapter(Message.class, new CouchDbJsonSerializer<Message>());
builder.registerTypeAdapter(DataProcessorType.class, new EpaTypeAdapter());
builder.registerTypeAdapter(URI.class, new UriSerializer());
builder.registerTypeAdapter(TopicDefinition.class, new JsonLdSerializer<TopicDefinition>());
builder.registerTypeAdapter(TopicDefinition.class, new CouchDbJsonSerializer<TopicDefinition>());
builder.registerTypeAdapter(TransformationRuleDescription.class,
new JsonLdSerializer<TransformationRuleDescription>());
new CouchDbJsonSerializer<TransformationRuleDescription>());
builder.registerTypeAdapterFactory(RuntimeTypeAdapterFactory.of(SpDataStream.class, "sourceType")
.registerSubtype(SpDataStream.class, "org.apache.streampipes.model.SpDataStream"));

Expand Down Expand Up @@ -142,10 +142,8 @@ public boolean shouldSkipField(FieldAttributes f) {
if (f.getName().equals("elementName")) {
return true;
}
if (f.getName().equals("elementId")) {
return true;
}
return false;
return f.getName()
.equals("elementId");
}

@Override
Expand Down

0 comments on commit bc62892

Please sign in to comment.