01: package samples.encoding;
02:
03: public class Data {
04: public String stringMember;
05: public Float floatMember;
06: public Data dataMember;
07:
08: public String toString() {
09: return getStringVal("", this );
10: }
11:
12: public String getStringVal(String indent, Data topLevel) {
13: String ret = "\n" + indent + "Data:\n";
14: ret += indent + " str[" + stringMember + "]\n";
15: ret += indent + " float[" + floatMember + "]\n";
16: ret += indent + " data[";
17:
18: if (dataMember != null) {
19: if (dataMember == topLevel) {
20: ret += " top level";
21: } else
22: ret += dataMember.getStringVal(indent + " ", topLevel)
23: + "\n" + indent;
24: } else
25: ret += " null";
26:
27: ret += " ]";
28: return ret;
29: }
30: }
|