Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 07cf72bd

Přidáno uživatelem Jan Havlíček před asi 4 roky(ů)

re #7891 formatting dictionaries removed

Zobrazit rozdíly:

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, Map<String, String> formatting, boolean child)
227
    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata, boolean child)
228 228
    {
229 229
        StringBuffer sb = new StringBuffer();
230 230
        String val = "";
......
233 233
        {
234 234
            sb.append(indentation);
235 235
        }
236
        sb.append("{" + formatting.get("lineBreak"));
236
        sb.append("{\n");
237 237

  
238
        indentation += formatting.get("indent");
238
        indentation += "\t";
239 239

  
240 240
        // ClassName
241
        sb.append(indentation).append(formatting.get("keywordCol")).append("class ").append(formatting.get("closeTagCol"));
242
        sb.append(formatting.get("classCol")).append(this.name).append(formatting.get("closeTagCol"));
241
        sb.append(indentation).append("class ");
242
        sb.append(this.name);
243 243
        // extends
244 244
        if (this.superclass != null) {
245
            sb.append(formatting.get("keywordCol")).append(" extends ").append(formatting.get("closeTagCol"));
246
            sb.append(formatting.get("classCol")).append(this.superclass.name).append(formatting.get("closeTagCol"));
245
            sb.append(" extends ");
246
            sb.append(this.superclass.name);
247 247
        }
248 248
        // implements
249 249
        if (this.interfaces != null) {
250
            sb.append(formatting.get("keywordCol")).append(" implements ").append(formatting.get("closeTagCol"));
250
            sb.append(" implements ");
251 251
            for (String str : this.interfaces) {
252
                sb.append(formatting.get("classCol")).append(str).append(formatting.get("closeTagCol"));
252
                sb.append(str);
253
                if(this.interfaces[this.interfaces.length-1] != str)
254
                {
255
                    sb.append(", ");
256
                }
253 257
            }
254 258
        }
255 259
        sb.append(" : {"); // ending of first line
256 260
        
257
        indentation += formatting.get("indent");
261
        indentation += "\t";
258 262

  
259 263
        for (field f : this.fields) {
260 264
            // v this.fielddata najit element, jehoz key == classdesc
......
268 272

  
269 273
            if(locVal instanceof content)
270 274
            {
271
                val = ((content)locVal).toJson(indentation, fielddata, formatting, true);
275
                val = ((content)locVal).toJson(indentation, fielddata, true);
272 276
            }
273 277
            else {
274 278
                val = locVal.toString();
275 279
            }
276 280

  
277
            String locStringTest = formatting.get("lineBreak") + indentation +
278
                formatting.get("fieldCol") + "\"" + f.name + "\"" + formatting.get("closeTagCol") +
279
                " : " + val;
281
            String locStringTest = "\n" + indentation + "\"" + f.name + "\"" + " : " + val;
280 282
            sb.append(locStringTest);
281 283
            /*sb.append(formatting.get("lineBreak")).append(indentation);
282 284
            sb.append(formatting.get("fieldCol")).append("\"").append(f.name).append("\"").append(formatting.get("closeTagCol"));
......
287 289
                sb.append(", ");
288 290
            }
289 291
        }
290
        indentation = indentation.replaceFirst(formatting.get("indent"), "");
292
        indentation = indentation.replaceFirst("\t", "");
291 293

  
292
        sb.append(formatting.get("lineBreak")).append(indentation).append("}");
294
        sb.append("\n").append(indentation).append("}");
293 295

  
294 296
        if(this.superclass != null)
295 297
        {
296
            indentation = indentation.replaceFirst(formatting.get("indent"), "");
297
            sb.append(formatting.get("lineBreak")).append("}");
298
            sb.append("," + formatting.get("lineBreak"));
299
            sb.append(this.superclass.toJson(indentation, fielddata, formatting, child));
298
            indentation = indentation.replaceFirst("\t", "");
299
            sb.append("\n").append("}");
300
            sb.append("," + "\n");
301
            sb.append(this.superclass.toJson(indentation, fielddata, child));
300 302
        }
301 303
        else 
302 304
        {
303
            indentation = indentation.replaceFirst(formatting.get("indent"), "");
304
            sb.append(formatting.get("lineBreak")).append(indentation).append("}");
305
            indentation = indentation.replaceFirst("\t", "");
306
            sb.append("\n").append(indentation).append("}");
305 307
        }
306 308

  
307 309
        return sb.toString();

Také k dispozici: Unified diff