src/org/nutz/lang/Dumps.java
public static String obj(Object obj) {
        if (null == obj)
            return "null";
        StringBuilder sb = new StringBuilder(obj.getClass().getName() + "\n\n[Fields:]");
        Mirror<?> mirror = Mirror.me(obj.getClass());
        for (Field f : mirror.getType().getFields())
            if (Modifier.isPublic(f.getModifiers()))
                try {
                    sb.append(String.format("\n\t%10s : %s", f.getName(), f.get(obj)));
                }
                catch (Exception e1) {
                    sb.append(String.format("\n\t%10s : %s", f.getName(), e1.getMessage()));
                }
        sb.append("\n\n[Methods:]");
        for (Method m : mirror.getType().getMethods())
            if (Modifier.isPublic(m.getModifiers()))
                if (m.getName().startsWith("get"))
                    if (m.getParameterTypes().length == 0)
                        try {
                            sb.append(String.format("\n\t%10s : %s", m.getName(), m.invoke(obj)));
                        }
                        catch (Exception e) {
                            sb.append(String.format("\n\t%10s : %s", m.getName(), e.getMessage()));
                        }
        return sb.toString();
    }
public static String obj(Object obj) {
        if (null == obj)
            return "null";
        StringBuilder sb = new StringBuilder(obj.getClass().getName() + "\n\n[Fields:]");
        Mirror<?> mirror = Mirror.me(obj.getClass());
        for (Field f : mirror.getType().getFields())
            if (Modifier.isPublic(f.getModifiers()))
                try {
                    sb.append(String.format("\n\t%10s : %s", f.getName(), f.get(obj)));
                }
                catch (Exception e1) {
                    sb.append(String.format("\n\t%10s : %s", f.getName(), e1.getMessage()));
                }
        sb.append("\n\n[Methods:]");
        for (Method m : mirror.getType().getMethods())
            if (Modifier.isPublic(m.getModifiers()))
                if (m.getName().startsWith("get"))
                    if (m.getParameterTypes().length == 0)
                        try {
                            sb.append(String.format("\n\t%10s : %s", m.getName(), m.invoke(obj)));
                        }
                        catch (Exception e) {
                            sb.append(String.format("\n\t%10s : %s", m.getName(), e.getMessage()));
                        }
        return sb.toString();
    }
public static String obj ( Object obj ) { if ( null == obj ) return "null" ; StringBuilder sb = new StringBuilder ( obj . getClass ( ) . getName ( ) + "\n\n[Fields:]" ) ; Mirror < ? > mirror = Mirror . me ( obj . getClass ( ) ) ; for ( Field f : mirror . getType ( ) . getFields ( ) ) if ( Modifier . isPublic ( f . getModifiers ( ) ) ) try { sb . append ( String . format ( "\n\t%10s : %s" , f . getName ( ) , f . get ( obj ) ) ) ; } catch ( Exception e1 ) { sb . append ( String . format ( "\n\t%10s : %s" , f . getName ( ) , e1 . getMessage ( ) ) ) ; } sb . append ( "\n\n[Methods:]" ) ; for ( Method m : mirror . getType ( ) . getMethods ( ) ) if ( Modifier . isPublic ( m . getModifiers ( ) ) ) if ( m . getName ( ) . startsWith ( "get" ) ) if ( m . getParameterTypes ( ) . length == 0 ) try { sb . append ( String . format ( "\n\t%10s : %s" , m . getName ( ) , m . invoke ( obj ) ) ) ; } catch ( Exception e ) { sb . append ( String . format ( "\n\t%10s : %s" , m . getName ( ) , e . getMessage ( ) ) ) ; } return sb . toString ( ) ; }
显示一个对象所有个 getter 函数返回，以及 public 的 Field 的值

@param obj
对象
@return 信息
显示一个对象所有个 getter 函数返回，以及 public 的 Field 的值