Skip to content

Commit

Permalink
chore(operator): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jsenko committed Oct 23, 2024
1 parent 737751c commit 4b143e1
Showing 1 changed file with 0 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import io.apicurio.registry.operator.OperatorException;

import java.io.IOException;

import static java.util.Objects.requireNonNull;

public class Mapper {

private static final ObjectMapper MAPPER;
Expand All @@ -24,17 +20,6 @@ public class Mapper {
YAML_MAPPER.registerModule(new JavaTimeModule());
}

public static <T> T duplicate(T source, Class<T> type) {
requireNonNull(source);
requireNonNull(type);
try {
var json = MAPPER.writeValueAsString(source);
return MAPPER.readValue(json, type);
} catch (IOException ex) {
throw new OperatorException("Could not duplicate value of type " + type.getCanonicalName(), ex);
}
}

public static String toYAML(Object value) {
try {
return YAML_MAPPER.writeValueAsString(value);
Expand Down

0 comments on commit 4b143e1

Please sign in to comment.