io.github.honoriuss.blossom.BlossomObjectMapperImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tracking-blossom Show documentation
Show all versions of tracking-blossom Show documentation
Track your app nice and convenient
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