@Override public SELF object(String key, Map<?, ?> map) { if (key == null) object(); else object(key); for (Map.Entry<?, ?> entry : map.entrySet()) { Object o = entry.getValue(); if (!(entry.getKey() instanceof String)) throw new JsonWriterException("Invalid key type for map: " + (entry.getKey() == null ? "null" : entry.getKey().getClass())); String k = (String) entry.getKey(); value(k, o); } return end(); }
@Override public SELF object(String key, Map<?, ?> map) { if (key == null) object(); else object(key); for (Map.Entry<?, ?> entry : map.entrySet()) { Object o = entry.getValue(); if (!(entry.getKey() instanceof String)) throw new JsonWriterException("Invalid key type for map: " + (entry.getKey() == null ? "null" : entry.getKey().getClass())); String k = (String) entry.getKey(); value(k, o); } return end(); }
@Override public SELF object(String key, Map<?, ?> map) { if (key == null) object(); else object(key); for (Map.Entry<?, ?> entry : map.entrySet()) { Object o = entry.getValue(); if (!(entry.getKey() instanceof String)) throw new JsonWriterException("Invalid key type for map: " + (entry.getKey() == null ? "null" : entry.getKey().getClass())); String k = (String) entry.getKey(); value(k, o); } return end(); }
@Override public SELF array(String key, Collection<?> c) { if (key == null) array(); else array(key); for (Object o : c) { value(o); } return end(); }
@Override public SELF array(String key, Collection<?> c) { if (key == null) array(); else array(key); for (Object o : c) { value(o); } return end(); }
@Override public SELF array(String key, Collection<?> c) { if (key == null) array(); else array(key); for (Object o : c) { value(o); } return end(); }
@Override public SELF value(Object o) { if (o == null) return nul(); else if (o instanceof String) return value((String) o); else if (o instanceof Number) return value(((Number) o)); else if (o instanceof Boolean) return value((boolean) (Boolean) o); else if (o instanceof Collection) return array((Collection<?>) o); else if (o instanceof Map) return object((Map<?, ?>) o); else if (JsonTypes.isArray(o)) return array((Json.Array)o); else if (JsonTypes.isObject(o)) return object((Json.Object)o); // TODO(mmastrac): Implement in future playn-server // else if (o.getClass().isArray()) { // int length = Array.getLength(o); // array(); // for (int i = 0; i < length; i++) // value(Array.get(o, i)); // return end(); else throw new JsonWriterException("Unable to handle type: " + o.getClass()); }
@Override public SELF value(String key, Object o) { if (o == null) return nul(key); else if (o instanceof String) return value(key, (String) o); else if (o instanceof Number) return value(key, (Number) o); else if (o instanceof Boolean) return value(key, (boolean) (Boolean) o); else if (o instanceof Collection) return array(key, (Collection<?>) o); else if (o instanceof Map) return object(key, (Map<?, ?>) o); else if (JsonTypes.isArray(o)) return array(key, (Json.Array)o); else if (JsonTypes.isObject(o)) return object(key, (Json.Object)o); // TODO(mmastrac): Implement in future playn-server // else if (o.getClass().isArray()) { // int length = Array.getLength(o); // array(key); // for (int i = 0; i < length; i++) // value(Array.get(o, i)); // return end(); else throw new JsonWriterException("Unable to handle type: " + o.getClass()); }
@Override public SELF value(Object o) { if (o == null) return nul(); else if (o instanceof String) return value((String) o); else if (o instanceof Number) return value(((Number) o)); else if (o instanceof Boolean) return value((boolean) (Boolean) o); else if (o instanceof Collection) return array((Collection<?>) o); else if (o instanceof Map) return object((Map<?, ?>) o); else if (JsonTypes.isArray(o)) return array((Json.Array)o); else if (JsonTypes.isObject(o)) return object((Json.Object)o); // TODO(mmastrac): Implement in future playn-server // else if (o.getClass().isArray()) { // int length = Array.getLength(o); // array(); // for (int i = 0; i < length; i++) // value(Array.get(o, i)); // return end(); else throw new JsonWriterException("Unable to handle type: " + o.getClass()); }
@Override public SELF value(String key, Object o) { if (o == null) return nul(key); else if (o instanceof String) return value(key, (String) o); else if (o instanceof Number) return value(key, (Number) o); else if (o instanceof Boolean) return value(key, (boolean) (Boolean) o); else if (o instanceof Collection) return array(key, (Collection<?>) o); else if (o instanceof Map) return object(key, (Map<?, ?>) o); else if (JsonTypes.isArray(o)) return array(key, (Json.Array)o); else if (JsonTypes.isObject(o)) return object(key, (Json.Object)o); // TODO(mmastrac): Implement in future playn-server // else if (o.getClass().isArray()) { // int length = Array.getLength(o); // array(key); // for (int i = 0; i < length; i++) // value(Array.get(o, i)); // return end(); else throw new JsonWriterException("Unable to handle type: " + o.getClass()); }
@Override public SELF value(String key, Object o) { if (o == null) return nul(key); else if (o instanceof String) return value(key, (String) o); else if (o instanceof Number) return value(key, (Number) o); else if (o instanceof Boolean) return value(key, (boolean) (Boolean) o); else if (o instanceof Collection) return array(key, (Collection<?>) o); else if (o instanceof Map) return object(key, (Map<?, ?>) o); else if (JsonTypes.isArray(o)) return array(key, (Json.Array)o); else if (JsonTypes.isObject(o)) return object(key, (Json.Object)o); // TODO(mmastrac): Implement in future playn-server // else if (o.getClass().isArray()) { // int length = Array.getLength(o); // array(key); // for (int i = 0; i < length; i++) // value(Array.get(o, i)); // return end(); else throw new JsonWriterException("Unable to handle type: " + o.getClass()); }
@Override public SELF value(Object o) { if (o == null) return nul(); else if (o instanceof String) return value((String) o); else if (o instanceof Number) return value(((Number) o)); else if (o instanceof Boolean) return value((boolean) (Boolean) o); else if (o instanceof Collection) return array((Collection<?>) o); else if (o instanceof Map) return object((Map<?, ?>) o); else if (JsonTypes.isArray(o)) return array((Json.Array)o); else if (JsonTypes.isObject(o)) return object((Json.Object)o); // TODO(mmastrac): Implement in future playn-server // else if (o.getClass().isArray()) { // int length = Array.getLength(o); // array(); // for (int i = 0; i < length; i++) // value(Array.get(o, i)); // return end(); else throw new JsonWriterException("Unable to handle type: " + o.getClass()); }