Search in sources :

Example 1 with FilterHint

use of com.navercorp.pinpoint.web.filter.FilterHint in project pinpoint by naver.

the class FilterHintListJsonDeserializer method deserialize.

@Override
public FilterHint deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
    if (!jp.getCurrentToken().isStructStart()) {
        throw ctxt.mappingException(RpcHint.class, jp.getCurrentToken());
    }
    // skip json start
    final JsonToken jsonToken = jp.nextToken();
    if (jsonToken == JsonToken.END_OBJECT) {
        return new FilterHint(Collections.<RpcHint>emptyList());
    }
    List<RpcHint> rpcHintList = new ArrayList<>();
    while (true) {
        final RpcHint rpcHint = jp.readValueAs(RpcHint.class);
        rpcHintList.add(rpcHint);
        if (jp.nextToken() == JsonToken.END_OBJECT) {
            break;
        }
    }
    return new FilterHint(rpcHintList);
}
Also used : FilterHint(com.navercorp.pinpoint.web.filter.FilterHint) ArrayList(java.util.ArrayList) JsonToken(com.fasterxml.jackson.core.JsonToken) RpcHint(com.navercorp.pinpoint.web.filter.RpcHint)

Aggregations

JsonToken (com.fasterxml.jackson.core.JsonToken)1 FilterHint (com.navercorp.pinpoint.web.filter.FilterHint)1 RpcHint (com.navercorp.pinpoint.web.filter.RpcHint)1 ArrayList (java.util.ArrayList)1