use of com.fasterxml.jackson.core.JsonToken in project atlasmap by atlasmap.
the class ActionsJsonDeserializer method processConvertMassUnitJsonToken.
protected ConvertMassUnit processConvertMassUnitJsonToken(JsonParser jsonToken) throws IOException {
ConvertMassUnit action = new ConvertMassUnit();
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.FROM_UNIT:
jsonToken.nextToken();
action.setFromUnit(MassUnitType.fromValue(jsonToken.getValueAsString()));
break;
case ActionsJsonSerializer.TO_UNIT:
jsonToken.nextToken();
action.setToUnit(MassUnitType.fromValue(jsonToken.getValueAsString()));
break;
default:
break;
}
nextToken = jsonToken.nextToken();
} while (!JsonToken.END_ARRAY.equals(nextToken) && !JsonToken.END_OBJECT.equals(nextToken));
return action;
}
use of com.fasterxml.jackson.core.JsonToken in project Payara by payara.
the class ProgressStatusEventJsonProprietaryReader method readProgressStatusEvent.
public static ProgressStatusEvent readProgressStatusEvent(JsonParser jp) throws IOException {
String id = null;
JsonToken token = null;
ProgressStatusEvent result = null;
while ((token = jp.nextToken()) != JsonToken.END_OBJECT) {
if (token == JsonToken.START_OBJECT) {
String nm = jp.getCurrentName();
if ("set".equals(nm)) {
result = new ProgressStatusEventSet(id);
readToPSEventSet((ProgressStatusEventSet) result, jp);
} else if ("progres".equals(nm)) {
result = new ProgressStatusEventProgress(id);
readToPSEventProgress((ProgressStatusEventProgress) result, jp);
} else if ("complete".equals(nm)) {
result = new ProgressStatusEventComplete(id);
readToPSEventComplete((ProgressStatusEventComplete) result, jp);
} else if ("create-child".equals(nm)) {
result = new ProgressStatusEventCreateChild(id);
readToPSEventCreateChild((ProgressStatusEventCreateChild) result, jp);
}
} else {
String fieldname = jp.getCurrentName();
if ("id".equals(fieldname)) {
// move to value
jp.nextToken();
id = jp.getText();
}
}
}
return result;
}
Aggregations