com.arextest.web.model.contract.contracts.config.replay.ComparisonSummaryConfiguration Maven / Gradle / Ivy
package com.arextest.web.model.contract.contracts.config.replay;
import com.arextest.web.model.contract.contracts.compare.CategoryDetail;
import com.arextest.web.model.contract.contracts.compare.TransformDetail;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.KeyDeserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import lombok.Data;
/**
* Created by rchen9 on 2023/2/8.
*/
@Data
public class ComparisonSummaryConfiguration {
private String operationName;
private List operationTypes;
/**
* ignore configuration List stores the absolute path of leaf node Set stores multiple
* leaf nodes
*/
private Set> exclusionList;
private List ignoreCategoryTypes;
/**
* only compare which leaf nodes List stores the absolute path of leaf node Set stores
* multiple leaf nodes
*/
private Set> inclusionList;
/**
* only compare which leaf nodes List stores the absolute path of leaf node Set stores
* multiple leaf nodes
*/
private Set> encryptionList;
/**
* reference relationship
*
* List stores the absolute path of leaf node K: fk node path V: pk node path
*/
@JsonDeserialize(keyUsing = MapKeyDeserializerUtils.class)
@JsonSerialize(keyUsing = MapKeySerializerUtils.class)
private Map, List> referenceMap;
/**
* array collation K: the absolute path of the array node V: a collection of leaf nodes under K,
* List stores the relative path
*/
@JsonDeserialize(keyUsing = MapKeyDeserializerUtils.class)
@JsonSerialize(keyUsing = MapKeySerializerUtils.class)
private Map, List>> listSortMap;
private List transformDetails;
private Map additionalConfig;
private static class MapKeyDeserializerUtils extends KeyDeserializer {
@Override
public Object deserializeKey(String s, DeserializationContext deserializationContext)
throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readValue(s, new TypeReference>() {
});
}
}
private static class MapKeySerializerUtils extends JsonSerializer> {
@Override
public void serialize(List stringList, JsonGenerator jsonGenerator,
SerializerProvider serializerProvider) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
String string = objectMapper.writeValueAsString(stringList);
jsonGenerator.writeFieldName(string);
}
}
}