public class ServerUnmarshaller implements Unmarshaller<Server> {
@Override
public Server toModel(String json) {
WSUtils utils = WSUtils.getINSTANCE();
Object map = utils.parse(json);
Server server = new Server()
.setId(utils.getString(map, "id"))
.setVersion(utils.getString(map, "version"))
.setStatusMessage(utils.getString(map, "status_msg"));
String status = utils.getString(map, "status");
if (status != null) {
server.setStatus(Server.Status.valueOf(status));
}
return server;
}