default JsonObject asJsonObject() { return getJson().asJsonObject(); }
protected void setSwagger(ApiImpl api) { Try.throwUnchecked(() -> { StringBuilder s = new StringBuilder(); swaggerJsonWriter.write(api.getMetadata(), s); JsonObject swagger = JSON.parse(s.toString()).asJsonObject(); api.setSwagger(swagger); }); }
@Override public void parseJson(JsonValue value) { JsonObject o = value.asJsonObject(); this.catalog = o.getString("catalog"); this.schema = o.getString("schema"); this.name = o.getString("name"); } }
private void prepare(Map<String, OpsGroup> map, JsonObject swagger) { JsonArray tags = swagger.getArray(TAGS); if(null == tags || tags.isEmpty()) { map.put(DEFAULT, new OpsGroup(DEFAULT)); }else { tags.forEach(tag -> { OpsGroup group = new OpsGroup(tag.asJsonObject());; map.put(group.getName(), group); }); } }
@Override public void parseJson(JsonValue json) { if(json.isObject()) { JsonObject o = json.asJsonObject(); this.user = toRule(o.get("user")); this.client = toRule(o.get("client")); return; } Object v = json.raw(); if(v instanceof String) { this.parseString((String)v); return; } throw new IllegalStateException("Can't parse json value '" + v + "'"); }
@Override public void parseJson(JsonValue value) { JsonObject o = value.asJsonObject(); this.name = o.getString("name"); this.unique = o.getBoolean("unique",false); JsonArray columns = o.getArray("columnNames"); if(null != columns){ for(int i=0;i<columns.length();i++){ addColumnName(columns.getString(i)); } } } }
public MetaModel read(Resource file) { String content = file.getContent().trim(); if (content.length() == 0) { return null; } String name = Strings.upperFirst(Paths.getFileNameWithoutExtension(file.getFilename())); JsonObject o = JSON.parse(file.getContent()).asJsonObject(); if(o.asMap().isEmpty()) { return null; } MetaModel model = JSON.convert(o.asMap(), MetaModel.class); if (!Strings.isEmpty(model.getClassName())) { Class<?> c = Classes.tryForName(model.getClassName()); if (null == c) { throw new IllegalStateException("Model class '" + model.getClassName() + "' not found!"); } MType type = MTypes.getMType(c); if (!type.isComplexType()) { throw new IllegalStateException("The model class '" + model.getClassName() + "' must be complex type!"); } MetaUtils.tryCopyModel(type.asComplexType(), model); } MApiModelBuilder am = nonValidateSwaggerReader.readModel(name, o.asMap(), new SwaggerTypeEx()); MetaUtils.tryCopyModel(am, model); validator.validate("Model(" + model.getName() + ")", model); return model; }
@Override public void parseJson(JsonValue value) { JsonObject o = value.asJsonObject(); this.catalog = o.getString("catalog"); this.schema = o.getString("schema"); this.name = o.getString("name"); this.quoted = o.getBoolean("quoted", false); this.minValue = o.getLong("minValue"); this.maxValue = o.getLong("maxValue"); this.increment = o.getInteger("increment"); this.start = o.getLong("start"); this.cache = o.getInteger("cache"); this.cycle = o.getBoolean("cycle"); } }
@Override public void parseJson(JsonValue value) { JsonObject o = value.asJsonObject(); if(null != columns){ for(JsonValue v : columns){ JsonObject column = v.asJsonObject(); addColumn(new DbForeignKeyColumn(column.getString("localColumnName"), column.getString("foreignColumnName")));
@Override public void parseJson(JsonValue value) { JsonObject o = value.asJsonObject(); this.name = o.getString("name"); this.typeCode = o.getInteger("typeCode"); this.typeName = o.getString("typeName"); this.length = o.getInteger("length"); this.precision = o.getInteger("precision"); this.scale = o.getInteger("scale"); this.nullable = o.getBoolean("nullable"); this.primaryKey = o.getBoolean("primaryKey"); this.unique = o.getBoolean("unique"); this.autoIncrement = o.getBoolean("autoIncrement"); this.comment = o.getString("comment"); this.defaultValue = o.getString("defaultValue"); } }
@Override public void parseJson(JsonValue json) { JsonObject o = json.asJsonObject(); this.catalog = o.getString("catalog"); this.name = o.getString("name"); JsonArray tables = o.getArray("tables"); if(null != tables){ for(JsonValue v : tables){ DbTableBuilder tb = new DbTableBuilder(); tb.parseJson(v); addTable(tb.build()); } } JsonArray sequences = o.getArray("sequences"); if(null != sequences){ for(JsonValue v : sequences){ DbSequenceBuilder sb = new DbSequenceBuilder(); sb.parseJson(v); addSequence(sb.build()); } } } }
throw new OAuth2InternalServerException("Invalid response from auth server : not a json map"); }else{ JsonObject o = json.asJsonObject();
@Override public void parseJson(JsonValue value) { JsonObject o = value.asJsonObject();