public <A extends Appendable> A document(A output) throws IOException {
        StringBuilder line = new StringBuilder();
        for (Field field: Beans.getKnownInstanceFields(_prototype)) {
            description d = field.getAnnotation(description.class);
            if (d == null) continue;

            placeholder p = field.getAnnotation(placeholder.class);
            String n = Strings.splitCamelCase(field.getName(), "-").toLowerCase();
            char key = getShortOptionKey(field);
            if ((field.getType() == Boolean.class || field.getType() == Boolean.TYPE) && _booleans.containsKey(key)) {
                line.append("  -").append(key).append(", --").append(n);
            } else {
                line.append("  --").append(n).append('=').append(p != null ? p.value() : "value");
            }
                if (line.length() < 16) {
                    for (int i = line.length(); i < 16; ++i) line.append(' ');
                    line.append(d.value());
                } else {
                    line.append("\n\t\t").append(d.value());
                }
            output.append(line.toString()).append('\n');
            line.setLength(0);
        }

        return output;
    }
public < A extends Appendable > A document ( A output ) throws IOException { StringBuilder line = new StringBuilder ( ) ; for ( Field field : Beans . getKnownInstanceFields ( _prototype ) ) { description d = field . getAnnotation ( description . class ) ; if ( d == null ) continue ; placeholder p = field . getAnnotation ( placeholder . class ) ; String n = Strings . splitCamelCase ( field . getName ( ) , "-" ) . toLowerCase ( ) ; char key = getShortOptionKey ( field ) ; if ( ( field . getType ( ) == Boolean . class || field . getType ( ) == Boolean . TYPE ) && _booleans . containsKey ( key ) ) { line . append ( "  -" ) . append ( key ) . append ( ", --" ) . append ( n ) ; } else { line . append ( "  --" ) . append ( n ) . append ( '=' ) . append ( p != null ? p . value ( ) : "value" ) ; } if ( line . length ( ) < 16 ) { for ( int i = line . length ( ) ; i < 16 ; ++ i ) line . append ( ' ' ) ; line . append ( d . value ( ) ) ; } else { line . append ( "\n\t\t" ) . append ( d . value ( ) ) ; } output . append ( line . toString ( ) ) . append ( '\n' ) ; line . setLength ( 0 ) ; } return output ; }
Writes usage documentation to an Appendable.
@param output an Appendable to write the usage to
@return the same Appendable