Projekt

Obecné

Profil

« Předchozí | Další » 

Revize c61a2b97

Přidáno uživatelem Michal Horký před více než 4 roky(ů)

re #7879

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

Zobrazit rozdíly:

project/Deserializer/src/jdeserialize/arrayobj.java
32 32
        this.data = data;
33 33
    }
34 34

  
35
    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata) {
35
    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting) {
36 36
        StringBuilder sb = new StringBuilder();
37 37
        sb.append("[ ");
38 38

  
39 39
        for (Object el : this.data) {
40 40
            if (el != null) {
41 41
                if (el instanceof content) {
42
                    sb.append(((content) el).toJson(indentation, fielddata));
42
                    sb.append(((content) el).toJson(indentation, fielddata, formatting));
43 43
                }else{
44 44
                    sb.append(el.toString());
45 45
                }
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();
project/Deserializer/src/jdeserialize/content.java
1 1
package jdeserialize;
2 2

  
3
import java.util.HashMap;
3 4
import java.util.Map;
4 5

  
5 6
/**
......
68 69
     */
69 70
    public void setIsExceptionObject(boolean value);
70 71

  
71
    public String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata);
72
    public String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting);
72 73
}
73 74

  
project/Deserializer/src/jdeserialize/contentbase.java
27 27
    public void validate() throws ValidityException {
28 28
    }
29 29

  
30
    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata)
30
    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting)
31 31
    {
32 32
        return this.toString();
33 33
    }
project/Deserializer/src/jdeserialize/enumobj.java
34 34
        this.classdesc = cd;
35 35
        this.value = so;
36 36
    }
37
    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata) {
37
    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting) {
38 38
        return this.value.value;
39 39
    }
40 40

  
project/Deserializer/src/jdeserialize/stringobj.java
18 18
        return x;
19 19
    }
20 20

  
21
    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata)
21
    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting)
22 22
    {
23 23
        return "\"" + this.value + "\"";
24 24
    }

Také k dispozici: Unified diff