public JsonObject getAsObject() { throw new JsonException("Not a JSON object") ; }
@Override public JSONWriterFacade value(Object o) { try { if (o instanceof String) valueString( (String) o ); else if (o instanceof Integer) valueInteger( (Integer) o ); else throw new IllegalArgumentException( "Given a " + o.getClass().getSimpleName() ); } catch (JsonException e) { throw new EncodingException(e.getMessage(), e); } return this; }
@Override public JSONWriterFacade endObject() { try { jw.finishObject(); } catch (JsonException e) { throw new EncodingException(e.getMessage(), e); } return this; }
public JsonBoolean getAsBoolean() { throw new JsonException("Not a JSON boolean") ; }
@Override public JSONWriterFacade value(boolean b) { try { jw.value(b); } catch (JsonException e) { throw new EncodingException(e.getMessage(), e); } return this; }
public JsonArray getAsArray() { throw new JsonException("Not a JSON array") ; }
@Override public JSONWriterFacade array() { try { jw.startArray(); } catch (JsonException e) { throw new EncodingException(e.getMessage(), e); } return this; }
public JsonNumber getAsNumber() { throw new JsonException("Not a JSON number") ; }
@Override public JSONWriterFacade endArray() { try { jw.finishArray(); } catch (JsonException e) { throw new EncodingException(e.getMessage(), e); } return this; }
public JsonString getAsString() { throw new JsonException("Not a JSON string") ; }
@Override public JSONWriterFacade value(long l) { try { jw.value(l); } catch (JsonException e) { throw new EncodingException(e.getMessage(), e); } return this; }
public JsonString getAsString() { throw new JsonException("Not a JSON string") ; }
@Override public JSONWriterFacade key(String s) { try { jw.key(s); } catch (JsonException e) { throw new EncodingException(e.getMessage(), e); } return this; }
public JsonNumber getAsNumber() { throw new JsonException("Not a JSON number") ; }
@Override public JSONWriterFacade object() { try { jw.startObject(); } catch (JsonException e) { throw new EncodingException(e.getMessage(), e); } return this; }
public JsonBoolean getAsBoolean() { throw new JsonException("Not a JSON boolean") ; }
@Override public JSONWriterFacade value(double d) { try { jw.value(d); } catch (JsonException e) { throw new EncodingException(e.getMessage(), e); } return this; }
public JsonArray getAsArray() { throw new JsonException("Not a JSON array") ; }
@Override public JSONWriterFacade value(Object o) { try { if (o instanceof String) jw.value( (String) o ); else if (o instanceof Double) jw.value( ((Double) o).doubleValue() ); else if (o instanceof Integer) jw.value( ((Integer) o).intValue() ); else if (o instanceof Float) jw.value( ((Float) o).doubleValue() ); else if (o instanceof Boolean) jw.value( ((Boolean) o).booleanValue() ); else if (o instanceof BigDecimal) jw.value( ((BigDecimal) o).doubleValue() ); else throw new RuntimeException( "given value: " + o + " [class " + o.getClass().getSimpleName() + "]" ); } catch (JsonException e) { throw new EncodingException(e.getMessage(), e); } return this; }
public JsonObject getAsObject() { throw new JsonException("Not a JSON object") ; }