Revize d6ee4876
Přidáno uživatelem Michal Horký před asi 4 roky(ů)
project/Deserializer/src/jdeserialize/arrayobj.java | ||
---|---|---|
1 | 1 |
package jdeserialize; |
2 | 2 |
|
3 | 3 |
/** |
4 |
* <p>Represents an array instance, including the values the comprise the array. </p> |
|
4 |
* <p> |
|
5 |
* Represents an array instance, including the values the comprise the array. |
|
6 |
* </p> |
|
5 | 7 |
* |
6 |
* <p>Note that in arrays of primitives, the classdesc will be named "[x", where x is the |
|
7 |
* field type code representing the primitive type. See jdeserialize.resolveJavaType() |
|
8 |
* for an example of analysis/generation of human-readable names from these class names.</p> |
|
8 |
* <p> |
|
9 |
* Note that in arrays of primitives, the classdesc will be named "[x", where x |
|
10 |
* is the field type code representing the primitive type. See |
|
11 |
* jdeserialize.resolveJavaType() for an example of analysis/generation of |
|
12 |
* human-readable names from these class names. |
|
13 |
* </p> |
|
9 | 14 |
*/ |
10 | 15 |
public class arrayobj extends contentbase { |
11 | 16 |
/** |
... | ... | |
24 | 29 |
this.classdesc = cd; |
25 | 30 |
this.data = data; |
26 | 31 |
} |
27 |
public String toString() { |
|
32 |
|
|
33 |
public @Override String toJson(String indentation) { |
|
28 | 34 |
StringBuilder sb = new StringBuilder(); |
29 | 35 |
sb.append("[ "); |
30 |
for(Object el : this.data) |
|
31 |
{ |
|
32 |
sb.append(el.toString()); |
|
33 |
if(!el.equals(this.data.get(this.data.size()-1))) |
|
34 |
{ |
|
35 |
sb.append(", "); |
|
36 |
|
|
37 |
for (Object el : this.data) { |
|
38 |
if (el != null && el instanceof content) { |
|
39 |
sb.append(((content)el).toJson(indentation)); |
|
40 |
// el null! |
|
41 |
if (!el.equals(this.data.get(this.data.size() - 1))) { |
|
42 |
sb.append(", "); |
|
43 |
} |
|
36 | 44 |
} |
37 | 45 |
} |
38 | 46 |
sb.append(" ]"); |
39 | 47 |
return sb.toString(); |
40 | 48 |
} |
41 |
} |
|
42 | 49 |
|
50 |
public String toString() { |
|
51 |
return "[array " + jdeserialize.hex(handle) + " classdesc " + classdesc.toString() + ": " + data.toString() |
|
52 |
+ "]"; |
|
53 |
} |
|
54 |
} |
Také k dispozici: Unified diff
re #7879
Converter.java a instance.java changed