/** * Writes a string array property. */ default JsonWriter property(String key, String[] a) { return key(key).array(a); }
/** * Writes a long array property. */ default JsonWriter property(String key, long[] a) { return key(key).array(a); }
/** * Writes an object array property. */ default JsonWriter property(String key, Iterable<Object> a) { return key(key).array(a); }
/** * Writes a string array property. */ default JsonWriter propertyString(String key, Iterable<String> a) { return key(key).arrayString(a); }
/** * Writes a property, the value will be wrote by the given {@link Runnable} function. */ default JsonWriter property(String key, Runnable propertyWriter) { key(key); if(null == propertyWriter){ null_(); }else{ propertyWriter.run(); } return this; }
/** * Writes an int array property. */ default JsonWriter property(String key, int[] a) { return key(key).array(a); }
/** * Writes a number array property. */ default JsonWriter property(String key, Number[] a) { return key(key).array(a); }
/** * Writes an object array property. */ default JsonWriter property(String key, Object[] a) { return key(key).array(a); }
/** * Writes a property, the value will be wrote by the given {@link JsonStringable} object. */ default JsonWriter property(String key, JsonStringable o) { key(key); if(null == o){ null_(); }else{ o.toJson(this); } return this; }
/** * Writes an array property. */ default JsonWriter propertyJsonable(String key, Iterable<? extends JsonStringable> iterable) { key(key).startArray(); if(null != iterable) { Iterator<? extends JsonStringable> iterator = iterable.iterator(); while (iterator.hasNext()){ JsonStringable o = iterator.next(); o.toJson(this); if(iterator.hasNext()){ this.separator(); } } } return endArray(); }
@Override public void toJson(JsonWriter writer) { writer.startObject(); writer.property("name", name) .key("columns").array(columnNames); writer.endObject(); }
@Override public void toJson(JsonWriter writer) { writer.startObject(); for(SchemaChange change : this){ writer.key(getChangeName(change)); change.toJson(writer); } writer.endObject(); }
/** * Writes an array property. */ default JsonWriter propertyJsonable(String key, JsonStringable... array) { key(key).startArray(); if(null != array) { int i = 0; for(JsonStringable o : array){ o.toJson(this); if(i < array.length - 1) { this.separator(); } i++; } } return endArray(); }
@Override public void toJson(JsonWriter writer) { writer.startObject(); writer.property("name", name); if(unique){ writer.property("unique", unique); } writer.key("columnNames").array(columnNames); writer.endObject(); } }