automation.library.conversion2jmx.postman2jmx.model.deserializer.ExecDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of library-conversion2jmx Show documentation
Show all versions of library-conversion2jmx Show documentation
The 'conversion2jmx' library to helps creating JMeter JMX files from different sources
The newest version!
package automation.library.conversion2jmx.postman2jmx.model.deserializer;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class ExecDeserializer extends JsonDeserializer {
public ExecDeserializer() {}
@Override
public ExecData deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
ExecData execData = new ExecData();
if (jsonParser.getCurrentToken() == JsonToken.VALUE_STRING) {
execData.addValue(jsonParser.getValueAsString());
} else if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
ObjectMapper mapper = new ObjectMapper();
List values = mapper.readValue(jsonParser, List.class);
execData.setValues(values);
}
return execData;
}
public class ExecData {
private List values = new ArrayList<>();
public void addValue(String value) {
this.values.add(value);
}
public List getValues() {
return this.values;
}
public void setValues(List values) {
this.values.addAll(values);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy