use of com.fasterxml.jackson.core.JsonFactory in project pinpoint by naver.
the class ObjectMapperIT method testConstructor.
@Test
public void testConstructor() throws Exception {
ObjectMapper mapper1 = new ObjectMapper();
ObjectMapper mapper2 = new ObjectMapper(new JsonFactory());
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
Constructor<?> omConstructor = ObjectMapper.class.getConstructor(JsonFactory.class, DefaultSerializerProvider.class, DefaultDeserializationContext.class);
Constructor<?> omConstructor1 = ObjectMapper.class.getConstructor();
Constructor<?> omConstructor2 = ObjectMapper.class.getConstructor(JsonFactory.class);
verifier.verifyTrace(event(SERVICE_TYPE, omConstructor));
verifier.verifyTrace(event(SERVICE_TYPE, omConstructor1));
verifier.verifyTrace(event(SERVICE_TYPE, omConstructor));
verifier.verifyTrace(event(SERVICE_TYPE, omConstructor2));
verifier.verifyTraceCount(0);
}
use of com.fasterxml.jackson.core.JsonFactory in project openhab1-addons by openhab.
the class JsonWeatherParser method parseInto.
/**
* {@inheritDoc}
*/
@Override
public void parseInto(InputStream is, Weather weather) throws Exception {
JsonFactory jsonFactory = new JsonFactory();
JsonParser jp = jsonFactory.createParser(is);
jp.nextValue();
handleToken(jp, null, weather);
jp.close();
super.parseInto(is, weather);
}
use of com.fasterxml.jackson.core.JsonFactory in project presto by prestodb.
the class TestJsonExtract method doExtract.
private static String doExtract(JsonExtractor<Slice> jsonExtractor, String json) throws IOException {
JsonFactory jsonFactory = new JsonFactory();
JsonParser jsonParser = jsonFactory.createParser(json);
// Advance to the first token
jsonParser.nextToken();
Slice extract = jsonExtractor.extract(jsonParser);
return (extract == null) ? null : extract.toStringUtf8();
}
use of com.fasterxml.jackson.core.JsonFactory in project ratpack by ratpack.
the class DefaultConfigDataBuilder method newDefaultObjectMapper.
public static ObjectMapper newDefaultObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
objectMapper.registerModule(new Jdk8Module());
objectMapper.registerModule(new GuavaModule());
objectMapper.registerModule(new JavaTimeModule());
JsonFactory factory = objectMapper.getFactory();
factory.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES);
factory.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES);
return objectMapper;
}
use of com.fasterxml.jackson.core.JsonFactory in project android-async-http by loopj.
the class CustomCASample method getResponseHandler.
@Override
public ResponseHandlerInterface getResponseHandler() {
return new BaseJsonHttpResponseHandler<SampleJSON>() {
@Override
public void onStart() {
clearOutputs();
}
@Override
public void onSuccess(int statusCode, Header[] headers, String rawJsonResponse, SampleJSON response) {
debugHeaders(LOG_TAG, headers);
debugStatusCode(LOG_TAG, statusCode);
if (response != null) {
debugResponse(LOG_TAG, rawJsonResponse);
}
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable throwable, String rawJsonData, SampleJSON errorResponse) {
debugHeaders(LOG_TAG, headers);
debugStatusCode(LOG_TAG, statusCode);
debugThrowable(LOG_TAG, throwable);
if (errorResponse != null) {
debugResponse(LOG_TAG, rawJsonData);
}
}
@Override
protected SampleJSON parseResponse(String rawJsonData, boolean isFailure) throws Throwable {
return new ObjectMapper().readValues(new JsonFactory().createParser(rawJsonData), SampleJSON.class).next();
}
};
}
Aggregations