io.github.honoriuss.blossom.BlossomObjectMapperImpl Maven / Gradle / Ivy
package io.github.honoriuss.blossom;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.honoriuss.blossom.interfaces.ITrackingObjectMapper;
import io.github.honoriuss.blossom.interfaces.ITrackingParameterRegistry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
class BlossomObjectMapperImpl implements ITrackingObjectMapper {
private final ObjectMapper mapper = new ObjectMapper();
private final ITrackingParameterRegistry parameterRegistry;
BlossomObjectMapperImpl(ITrackingParameterRegistry parameterRegistry) {
this.parameterRegistry = parameterRegistry;
}
@Override
@Deprecated
public String mapParameters(Object[] args, String[] parameterNames) {
var resultMap = new HashMap();
var parameterNamesList = new ArrayList<>(Arrays.stream(parameterNames).toList());
addRegistryEntries(resultMap);
addAnnotationEntries(args, parameterNamesList, resultMap);
return writeValueAsJsonString(resultMap);
}
@Override
public String mapParameters(List