Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 758dc669

Přidáno uživatelem Jan Havlíček před téměř 5 roky(ů)

re #7893 Added compare JOUD x Jackson
some minor issues in formatting repaired

Zobrazit rozdíly:

project/Deserializer/src/jdeserialize/arrayobj.java
42 42
            boolean isLast = (i == this.data.size()-1) || (this.data.get(i+1) == null);
43 43

  
44 44
            if (el != null) {
45
                if (el instanceof content) {
45
                if (el instanceof content && !(el instanceof stringobj)) {
46 46
                    if(!bracketInserted){
47 47
                        sb.append(NEW_LINE).append(indentation).append("[ " + NEW_LINE);
48 48
                        bracketInserted = true;
......
64 64
                        bracketInserted = true;
65 65
                    }
66 66
                    
67
                    sb.append(el.toString());
67
                    if(el instanceof stringobj)
68
                    {
69
                        sb.append(((stringobj)el).toJson(indentation, fielddata, false));
70
                    }else{
71
                        sb.append(el.toString());
72
                    }
68 73
                    
69 74
                    if (!isLast) {
70 75
                        sb.append(", ");
project/Deserializer/src/jdeserialize/classdesc.java
285 285
            }
286 286
        }
287 287

  
288
        closingJsonSeq(sb, indentation);
288
        indentation = closingJsonSeq(sb, indentation);
289 289

  
290 290
        //recursively call toJson for superclass if presented
291 291
        if (this.superclass != null) {
......
302 302
     * 
303 303
     * @param sb            StringBuffer where the closing sequence will be appended
304 304
     * @param indentation   Indentation to be changed
305
     * @return              The edited indentation String
305 306
     */
306
    private void closingJsonSeq(StringBuffer sb, String indentation)
307
    private String closingJsonSeq(StringBuffer sb, String indentation)
307 308
    {
308 309
        indentation = indentation.replaceFirst(INDENT, "");
309 310
        sb.append(NEW_LINE).append(indentation).append("}");
310 311

  
311 312
        indentation = indentation.replaceFirst(INDENT, "");
312 313
        sb.append(NEW_LINE).append(indentation).append("}");
314

  
315
        return indentation;
313 316
    }
314 317

  
315 318
    /**
project/comparison_jackson.txt
1
Pomocí Jackson:
2

  
3
serialized.
4
{
5
  "pozdrav" : "AHOJ",
6
  "testInt" : 123,
7
  "testDouble" : 1.0,
8
  "intArray" : [ 5, 10, 15 ],
9
  "stringArray" : [ "A", "B", "C" ],
10
  "locInnerClassInstance" : {
11
    "vnitrni" : "INNER STRING AM I"
12
  },
13
  "localEnum" : "LOW"
14
}
15

  
16
*********************************************
17
JOUD:
18

  
19
{
20
	class samples.ok.Simple extends samples.ok.SimpleChild : {
21
		"testDouble" : 1.0, 
22
		"testInt" : 123, 
23
		"intArray" : [ 5, 10, 15 ], 
24
		"locInnerClassInstance" : {
25
			class samples.ok.Inner : {
26
				"vnitrni" : "INNER STRING AM I"
27
			}
28
		}, 
29
		"localEnum" : LOW, 
30
		"pozdrav" : "AHOJ", 
31
		"stringArray" : [ "A", "B", "C" ]
32
	}
33
},
34
{
35
	class samples.ok.SimpleChild : {
36
		"navic" : "AHOJ, jsem tu navic"
37
	}
38
}
release_v0.4/app.config
1
#Wed May 06 18:06:02 CEST 2020
2
input_dir=E\:\\Projekty\\Mine\\ZSWI\\2020\\sw\\demo_jh\\Deserializer_tests\\serialized
release_v0.4/jdeserialize_out.txt
1
--- JDESERIALIZE BEGINS ---
2
read: samples.ok.Simple _h0x7e0007 = r_0x7e0000;  
3
--- JDESERIALIZE ENDS ---

Také k dispozici: Unified diff