Projekt

Obecné

Profil

« Předchozí | Další » 

Revize f9502614

Přidáno uživatelem Michal Horký před asi 4 roky(ů)

re #7879

Soubory Converter.java a instance.java změněny.

Zobrazit rozdíly:

project/Deserializer/src/jdeserialize/classdesc.java
223 223
            }
224 224
        }
225 225
    }
226

  
227
    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata)
228
    {
229
        StringBuffer sb = new StringBuffer();
230
        String val = "";
231
        
232
        indentation += "\t";
233

  
234
        // ClassName
235
        sb.append("{\n").append(indentation).append("class ").append(this.name);
236
        // extends
237
        if (this.superclass != null) {
238
            sb.append(" extends ").append(this.superclass.name);
239
        }
240
        // implements
241
        if (this.interfaces != null) {
242
            sb.append(" implements ");
243
            for (String str : this.interfaces) {
244
                sb.append(str);
245
            }
246
        }
247
        sb.append(" : {"); // ending of first line
248
        
249
        indentation += "\t";
250

  
251
        for (field f : this.fields) {
252
            // v this.fielddata najit element, jehoz key == classdesc
253
            // v tomto prvku fielddata najdu value (element) podle key == f
254
            // jeho value je chtena hodnota
255
            var locVal = fielddata.get(this).get(f);
256

  
257
            if(locVal instanceof content)
258
            {
259
                val = ((content)locVal).toJson(indentation, fielddata);
260
            }
261
            else {
262
                val = locVal.toString();
263
            }
264

  
265
            sb.append("\n").append(indentation);
266
            sb.append("\"").append(f.name).append("\"");
267
            sb.append(" : ");
268
            sb.append(val);
269

  
270
            if (!f.equals(this.fields[this.fields.length - 1])) {
271
                sb.append(", ");
272
            }
273
        }
274
        indentation = indentation.substring(0, indentation.length() - 1);
275

  
276
        sb.append("\n").append(indentation).append("}");
277
        
278

  
279
        if(this.superclass != null)
280
        {
281
            sb.append(",\n");
282
            sb.append(this.superclass.toJson(indentation, fielddata));
283
        }
284
        
285
        indentation = indentation.substring(0, indentation.length() - 1);
286
        sb.append(indentation).append("\n}");
287

  
288
        return sb.toString();
289
    }
226 290
}
227 291

  

Také k dispozici: Unified diff