001/*
002 * To change this template, choose Tools | Templates
003 * and open the template in the editor.
004 */
005package org.anarres.qemu.qapi.common;
006
007import com.fasterxml.jackson.annotation.JsonProperty;
008
009/**
010 *
011 * @author shevek
012 */
013public class QApiResponse<V> extends QApiObject {
014
015    @JsonProperty("return")
016    public V _return;
017    @JsonProperty
018    public QApiError error;
019
020    public boolean isError() {
021        return error != null;
022    }
023
024    public V getResult() throws QApiException {
025        if (isError())
026            throw new QApiException(error.desc);
027        return _return;
028    }
029}