public static String show(Object o) {
if (o==null) return "null";
- if (o instanceof Show) {
- StringBuffer ret = new StringBuffer();
- for(Field f : o.getClass().getFields()) {
- ret.append("\n" + f.getName() + " = ");
- try {
- ret.append(show(f.get(o)));
- } catch (Exception e) {
- ret.append("**"+e+"**");
- throw new RuntimeException(e);
- }
- }
- return o.getClass().getName() + " {" + StringUtil.indent(ret.toString(), 4) + "\n}";
- }
+ if (o instanceof Show) return ((Show)o).toString();
if (! (o instanceof Object[])) return o.toString() + " : " + o.getClass().getName();
Object[] arr = (Object[])o;
StringBuffer ret = new StringBuffer();
return ret.toString();
}
+ public static String show(Show o) {
+ StringBuffer ret = new StringBuffer();
+ for(Field f : o.getClass().getFields()) {
+ ret.append("\n" + f.getName() + " = ");
+ try {
+ ret.append(show(f.get(o)));
+ } catch (Exception e) {
+ ret.append("**"+e+"**");
+ throw new RuntimeException(e);
+ }
+ }
+ return o.getClass().getName() + " {" + StringUtil.indent(ret.toString(), 4) + "\n}";
+ }
+
public static Object lub(Object argo) {
if (argo instanceof Object[]) return lub((Object[])argo);
return argo;
return null;
}
- public static interface Show { }
+ public static interface Show {
+ }
}