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.core.JsonProcessingException;
008import com.fasterxml.jackson.databind.ObjectMapper;
009
010/**
011 * The base of all QApi objects.
012 *
013 * @author shevek
014 */
015public abstract class QApiObject {
016
017    @Override
018    public String toString() {
019        try {
020            ObjectMapper mapper = new ObjectMapper();
021            return mapper.writeValueAsString(this);
022        } catch (JsonProcessingException e) {
023            return String.valueOf(e);
024        }
025    }
026}