use of org.eclipse.che.api.debug.shared.model.event.DebuggerEvent.TYPE in project che by eclipse.
the class DebuggerEventUnmarshaller method unmarshal.
@Override
public void unmarshal(Message response) throws UnmarshallerException {
JSONObject jsonObject = JSONParser.parseStrict(response.getBody()).isObject();
if (jsonObject == null) {
return;
}
if (jsonObject.containsKey("type")) {
String type = jsonObject.get("type").isString().stringValue();
TYPE eventType = TYPE.valueOf(type);
switch(eventType) {
case SUSPEND:
event = dtoFactory.createDtoFromJson(jsonObject.toString(), SuspendEventDto.class);
break;
case DISCONNECT:
event = dtoFactory.createDtoFromJson(jsonObject.toString(), DisconnectEventDto.class);
break;
case BREAKPOINT_ACTIVATED:
event = dtoFactory.createDtoFromJson(jsonObject.toString(), BreakpointActivatedEventDto.class);
break;
default:
throw new UnmarshallerException("Can't parse response.", new IllegalArgumentException("Unknown debug event type: " + eventType));
}
}
}
Aggregations