@Override public String toString() { return JSON.stringify(map); } }
public String json(Object o) { return JSON.stringify(o); }
public String stringify(Object v) { return JSON.stringify(v); }
@Override public void execute(Options options) { options.append(JSON.stringify(options.getParameters().get(0))); } }
/** * Sets the json content type and body. */ default THttpRequest setJson(Object value) { setContentType(ContentTypes.APPLICATION_JSON_UTF8); return setBody(JSON.stringify(value)); }
protected void output(int status, Object result) { Output out = new Output(); out.status = status; out.result = result; writer.println(OUTPUT_PREFIX + JSON.stringify(out) + OUTPUT_SUFFIX); }
private void processReferenceToCompositeId(MetaApi api, MetaEntity entity, Map<String, MetaRelation> relations) { relations.forEach((name, relation) -> { //check relation exists. if (entity.getRelation(name) != null) { throw new IllegalStateException("Found duplicate relation '" + name + "' -> '"); } MetaEntity targetEntity = api.getEntity(relation.getTargetEntity()); Map<String, MetaField> targetId = targetEntity.getIdentity(); if (relation.getJoinFields().size() != targetId.size()) { throw new IllegalStateException("Incorrect size of join fields " + JSON.stringify(relation.getJoinFields()) + " , expected " + targetId.size() + " but " + relation.getJoinFields().size() + ", check relation '" + name + "'"); } entity.addRelation(relation); }); }
protected MType readType(String name, JsonObject property, SwaggerExtension ex) { String ref = property.getString(REF); if(!Strings.isEmpty(ref)) { return readRefType(ref); } String type = property.getString(TYPE); if(Strings.isEmpty(type)) { if(!validate) { return null; } throw new InvalidSpecException("Invalid type in property : " + JSON.stringify(property.raw())); } MType mtype = null != ex ? ex.readType(type) : null; if(null != mtype) { return mtype; } if(type.equals(OBJECT)) { return readObjectType(name, property); } if(type.equals(ARRAY)) { return readCollectionType(property.getObject(ITEMS), ex); } String format = property.getString(FORMAT); return readSimpleType(type, format); }
List<String> values = new ArrayList<>(); os.getItems().forEach(o -> { values.add(JSON.stringify(o.getValue())); }); v.setEnumValues(values.toArray(new String[0]));