Search in sources :

Example 66 with JsonToken

use of com.fasterxml.jackson.core.JsonToken in project atlasmap by atlasmap.

the class ActionsJsonDeserializer method processAddDaysJsonToken.

protected AddDays processAddDaysJsonToken(JsonParser jsonToken) throws IOException {
    AddDays action = new AddDays();
    if (JsonToken.END_ARRAY.equals(jsonToken.currentToken()) || JsonToken.END_OBJECT.equals(jsonToken.currentToken())) {
        return action;
    }
    JsonToken nextToken = null;
    do {
        if (JsonToken.START_OBJECT.equals(jsonToken.currentToken())) {
            jsonToken.nextToken();
        }
        switch(jsonToken.getCurrentName()) {
            case ActionsJsonSerializer.DAYS:
                jsonToken.nextToken();
                action.setDays(jsonToken.getIntValue());
                break;
            default:
                break;
        }
        nextToken = jsonToken.nextToken();
    } while (!JsonToken.END_ARRAY.equals(nextToken) && !JsonToken.END_OBJECT.equals(nextToken));
    return action;
}
Also used : JsonToken(com.fasterxml.jackson.core.JsonToken)

Example 67 with JsonToken

use of com.fasterxml.jackson.core.JsonToken in project atlasmap by atlasmap.

the class ActionsJsonDeserializer method processReplaceFirstJsonToken.

protected ReplaceFirst processReplaceFirstJsonToken(JsonParser jsonToken) throws IOException {
    ReplaceFirst action = new ReplaceFirst();
    if (JsonToken.END_ARRAY.equals(jsonToken.currentToken()) || JsonToken.END_OBJECT.equals(jsonToken.currentToken())) {
        return action;
    }
    JsonToken nextToken = null;
    do {
        if (JsonToken.START_OBJECT.equals(jsonToken.currentToken())) {
            jsonToken.nextToken();
        }
        switch(jsonToken.getCurrentName()) {
            case ActionsJsonSerializer.MATCH:
                jsonToken.nextToken();
                action.setMatch(jsonToken.getValueAsString());
                break;
            case ActionsJsonSerializer.NEW_STRING:
                jsonToken.nextToken();
                action.setNewString(jsonToken.getValueAsString());
                break;
            default:
                break;
        }
        nextToken = jsonToken.nextToken();
    } while (!JsonToken.END_ARRAY.equals(nextToken) && !JsonToken.END_OBJECT.equals(nextToken));
    return action;
}
Also used : JsonToken(com.fasterxml.jackson.core.JsonToken)

Example 68 with JsonToken

use of com.fasterxml.jackson.core.JsonToken in project atlasmap by atlasmap.

the class ActionsJsonDeserializer method processLastIndexOfJsonToken.

protected LastIndexOf processLastIndexOfJsonToken(JsonParser jsonToken) throws IOException {
    LastIndexOf action = new LastIndexOf();
    if (JsonToken.END_ARRAY.equals(jsonToken.currentToken()) || JsonToken.END_OBJECT.equals(jsonToken.currentToken())) {
        return action;
    }
    JsonToken nextToken = null;
    do {
        if (JsonToken.START_OBJECT.equals(jsonToken.currentToken())) {
            jsonToken.nextToken();
        }
        switch(jsonToken.getCurrentName()) {
            case ActionsJsonSerializer.STRING:
                jsonToken.nextToken();
                action.setString(jsonToken.getValueAsString());
                break;
            default:
                break;
        }
        nextToken = jsonToken.nextToken();
    } while (!JsonToken.END_ARRAY.equals(nextToken) && !JsonToken.END_OBJECT.equals(nextToken));
    return action;
}
Also used : JsonToken(com.fasterxml.jackson.core.JsonToken)

Example 69 with JsonToken

use of com.fasterxml.jackson.core.JsonToken in project atlasmap by atlasmap.

the class ActionsJsonDeserializer method processStartsWithJsonToken.

protected StartsWith processStartsWithJsonToken(JsonParser jsonToken) throws IOException {
    StartsWith action = new StartsWith();
    if (JsonToken.END_ARRAY.equals(jsonToken.currentToken()) || JsonToken.END_OBJECT.equals(jsonToken.currentToken())) {
        return action;
    }
    JsonToken nextToken = null;
    do {
        if (JsonToken.START_OBJECT.equals(jsonToken.currentToken())) {
            jsonToken.nextToken();
        }
        switch(jsonToken.getCurrentName()) {
            case ActionsJsonSerializer.STRING:
                jsonToken.nextToken();
                action.setString(jsonToken.getValueAsString());
                break;
            default:
                break;
        }
        nextToken = jsonToken.nextToken();
    } while (!JsonToken.END_ARRAY.equals(nextToken) && !JsonToken.END_OBJECT.equals(nextToken));
    return action;
}
Also used : JsonToken(com.fasterxml.jackson.core.JsonToken)

Example 70 with JsonToken

use of com.fasterxml.jackson.core.JsonToken in project atlasmap by atlasmap.

the class ActionsJsonDeserializer method processAppendJsonToken.

protected Append processAppendJsonToken(JsonParser jsonToken) throws IOException {
    Append action = new Append();
    if (JsonToken.END_ARRAY.equals(jsonToken.currentToken()) || JsonToken.END_OBJECT.equals(jsonToken.currentToken())) {
        return action;
    }
    JsonToken nextToken = null;
    do {
        if (JsonToken.START_OBJECT.equals(jsonToken.currentToken())) {
            jsonToken.nextToken();
        }
        switch(jsonToken.getCurrentName()) {
            case ActionsJsonSerializer.STRING:
                jsonToken.nextToken();
                action.setString(jsonToken.getValueAsString());
                break;
            default:
                break;
        }
        nextToken = jsonToken.nextToken();
    } while (!JsonToken.END_ARRAY.equals(nextToken) && !JsonToken.END_OBJECT.equals(nextToken));
    return action;
}
Also used : JsonToken(com.fasterxml.jackson.core.JsonToken)

Aggregations

JsonToken (com.fasterxml.jackson.core.JsonToken)72 JsonParser (com.fasterxml.jackson.core.JsonParser)14 IOException (java.io.IOException)14 ArrayList (java.util.ArrayList)8 SqlNullable (com.facebook.presto.spi.function.SqlNullable)7 SqlType (com.facebook.presto.spi.function.SqlType)7 JsonUtil.createJsonParser (com.facebook.presto.util.JsonUtil.createJsonParser)7 ScalarFunction (com.facebook.presto.spi.function.ScalarFunction)6 JsonParserHelper.assertExpectedJsonToken (com.alibaba.json.test.performance.JacksonPageModelParser.JsonParserHelper.assertExpectedJsonToken)5 JsonParseException (com.fasterxml.jackson.core.JsonParseException)3 LiteralParameters (com.facebook.presto.spi.function.LiteralParameters)2 RpcHint (com.navercorp.pinpoint.web.filter.RpcHint)2 InputStream (java.io.InputStream)2 ValueSerializationException (org.qi4j.api.value.ValueSerializationException)2 Company (com.alibaba.json.test.entity.Company)1 Department (com.alibaba.json.test.entity.Department)1 Employee (com.alibaba.json.test.entity.Employee)1 Group (com.alibaba.json.test.entity.Group)1 LayoutInstance (com.alibaba.json.test.entity.pagemodel.LayoutInstance)1 PageInstance (com.alibaba.json.test.entity.pagemodel.PageInstance)1