Revize f1c74177
Přidáno uživatelem Michal Horký před asi 4 roky(ů)
project/Deserializer/src/jdeserialize/classdesc.java | ||
---|---|---|
224 | 224 |
} |
225 | 225 |
} |
226 | 226 |
|
227 |
public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata) |
|
227 |
public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting)
|
|
228 | 228 |
{ |
229 | 229 |
StringBuffer sb = new StringBuffer(); |
230 | 230 |
String val = ""; |
231 | 231 |
|
232 |
sb.append(indentation).append("{\n");
|
|
232 |
sb.append(indentation).append("{" + formatting.get("lineBreak"));
|
|
233 | 233 |
|
234 |
indentation += "\t";
|
|
234 |
indentation += formatting.get("indent");
|
|
235 | 235 |
|
236 | 236 |
// ClassName |
237 | 237 |
sb.append(indentation).append("class ").append(this.name); |
... | ... | |
248 | 248 |
} |
249 | 249 |
sb.append(" : {"); // ending of first line |
250 | 250 |
|
251 |
indentation += "\t";
|
|
251 |
indentation += formatting.get("indent");
|
|
252 | 252 |
|
253 | 253 |
for (field f : this.fields) { |
254 | 254 |
// v this.fielddata najit element, jehoz key == classdesc |
... | ... | |
258 | 258 |
|
259 | 259 |
if(locVal instanceof content) |
260 | 260 |
{ |
261 |
val = ((content)locVal).toJson(indentation, fielddata); |
|
261 |
val = ((content)locVal).toJson(indentation, fielddata, formatting);
|
|
262 | 262 |
} |
263 | 263 |
else { |
264 | 264 |
val = locVal.toString(); |
265 | 265 |
} |
266 | 266 |
|
267 |
sb.append("\n").append(indentation);
|
|
267 |
sb.append(formatting.get("lineBreak")).append(indentation);
|
|
268 | 268 |
sb.append("\"").append(f.name).append("\""); |
269 | 269 |
sb.append(" : "); |
270 | 270 |
sb.append(val); |
... | ... | |
275 | 275 |
} |
276 | 276 |
indentation = indentation.substring(0, indentation.length() - 1); |
277 | 277 |
|
278 |
sb.append("\n").append(indentation).append("}");
|
|
278 |
sb.append(formatting.get("lineBreak")).append(indentation).append("}");
|
|
279 | 279 |
|
280 | 280 |
if(this.superclass != null) |
281 | 281 |
{ |
282 | 282 |
indentation = indentation.substring(0, indentation.length() - 1); |
283 |
sb.append("\n}");
|
|
284 |
sb.append(",\n");
|
|
285 |
sb.append(this.superclass.toJson(indentation, fielddata)); |
|
283 |
sb.append(formatting.get("lineBreak")).append("}");
|
|
284 |
sb.append("," + formatting.get("lineBreak"));
|
|
285 |
sb.append(this.superclass.toJson(indentation, fielddata, formatting));
|
|
286 | 286 |
} |
287 | 287 |
else |
288 | 288 |
{ |
289 | 289 |
indentation = indentation.substring(0, indentation.length() - 1); |
290 |
sb.append("\n").append(indentation).append("}");
|
|
290 |
sb.append(formatting.get("lineBreak")).append(indentation).append("}");
|
|
291 | 291 |
} |
292 | 292 |
|
293 | 293 |
return sb.toString(); |
Také k dispozici: Unified diff
re #7879
Soubor Converter.java a instance.java změněny.