use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonToken in project atlasmap by atlasmap.
the class ActionsJsonDeserializer method processCustomActionJsonToken.
protected CustomAction processCustomActionJsonToken(JsonParser jsonToken) throws IOException {
CustomAction action = new CustomAction();
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.CLASS_NAME:
jsonToken.nextToken();
action.setClassName(jsonToken.getValueAsString());
break;
case ActionsJsonSerializer.METHOD_NAME:
jsonToken.nextToken();
action.setMethodName(jsonToken.getValueAsString());
break;
default:
break;
}
nextToken = jsonToken.nextToken();
} while (!JsonToken.END_ARRAY.equals(nextToken) && !JsonToken.END_OBJECT.equals(nextToken));
return action;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonToken in project atlasmap by atlasmap.
the class ActionsJsonDeserializer method processSubStringBeforeJsonToken.
protected SubStringBefore processSubStringBeforeJsonToken(JsonParser jsonToken) throws IOException {
SubStringBefore action = new SubStringBefore();
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.START_INDEX:
jsonToken.nextToken();
action.setStartIndex(jsonToken.getIntValue());
break;
case ActionsJsonSerializer.END_INDEX:
jsonToken.nextToken();
action.setEndIndex(jsonToken.getIntValue());
break;
case ActionsJsonSerializer.MATCH:
jsonToken.nextToken();
action.setMatch(jsonToken.getValueAsString());
break;
default:
break;
}
nextToken = jsonToken.nextToken();
} while (!JsonToken.END_ARRAY.equals(nextToken) && !JsonToken.END_OBJECT.equals(nextToken));
return action;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonToken in project atlasmap by atlasmap.
the class ActionsJsonDeserializer method processPrependJsonToken.
protected Prepend processPrependJsonToken(JsonParser jsonToken) throws IOException {
Prepend action = new Prepend();
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;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonToken in project kie-wb-common by kiegroup.
the class AbstractParser method nextToken.
@Override
public JsonToken nextToken() throws IOException, JsonParseException {
JsonToken token = next();
tokenCount++;
return token;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonToken in project incubator-servicecomb-java-chassis by apache.
the class AbstractDeserializer method deserialize.
@Override
public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
Object result = createResult();
for (String fieldName = p.nextFieldName(); fieldName != null; fieldName = p.nextFieldName()) {
// p实际是ProtobufParser,其内部是可以直接取到proto field的,理论上可以根据id来索引
// 可是field默认没暴露出来,所以,直接用name索引了
ReaderHelpData helpData = readerHelpDataMap.get(fieldName);
if (helpData == null) {
continue;
}
JsonToken t = p.nextToken();
// Note: must handle null explicitly here; value deserializers won't
Object value = null;
if (t == JsonToken.VALUE_NULL) {
value = helpData.getDeser().getNullValue(ctxt);
} else {
value = helpData.getDeser().deserialize(p, ctxt);
}
result = updateResult(result, value, helpData);
}
return result;
}
Aggregations