1 package samples.encoding; 2 3 public class Data 4 { 5 public String stringMember; 6 public Float floatMember; 7 public Data dataMember; 8 9 public String toString() 10 { 11 return getStringVal("", this); 12 } 13 14 public String getStringVal(String indent, Data topLevel) 15 { 16 String ret = "\n" + indent + "Data:\n"; 17 ret += indent + " str[" + stringMember + "]\n"; 18 ret += indent + " float[" + floatMember + "]\n"; 19 ret += indent + " data["; 20 21 if (dataMember != null) { 22 if (dataMember == topLevel) { 23 ret += " top level"; 24 } else 25 ret += dataMember.getStringVal(indent + " ", topLevel) + "\n" + indent; 26 } else 27 ret += " null"; 28 29 ret += " ]"; 30 return ret; 31 } 32 } 33 | Popular Tags |