apps/src/main/java/com/sampullara/cli/Args.java
public static void usage(PrintStream errStream, Object target) {
        Class<?> clazz;
        if (target instanceof Class) {
            clazz = (Class) target;
        } else {
            clazz = target.getClass();
        }
        errStream.println("Usage: " + clazz.getName());
        for (Class<?> currentClazz = clazz; currentClazz != null;  currentClazz = currentClazz.getSuperclass()) {
          for (Field field : currentClazz.getDeclaredFields()) {
            fieldUsage(errStream, target, field);
          }
        }
        try {
            BeanInfo info = Introspector.getBeanInfo(clazz);
            for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
                propertyUsage(errStream, target, pd);
            }
        } catch (IntrospectionException e) {
            // If its not a JavaBean we ignore it
        }
    }
public static void usage(PrintStream errStream, Object target) {
        Class<?> clazz;
        if (target instanceof Class) {
            clazz = (Class) target;
        } else {
            clazz = target.getClass();
        }
        errStream.println("Usage: " + clazz.getName());
        for (Class<?> currentClazz = clazz; currentClazz != null;  currentClazz = currentClazz.getSuperclass()) {
          for (Field field : currentClazz.getDeclaredFields()) {
            fieldUsage(errStream, target, field);
          }
        }
        try {
            BeanInfo info = Introspector.getBeanInfo(clazz);
            for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
                propertyUsage(errStream, target, pd);
            }
        } catch (IntrospectionException e) {
            // If its not a JavaBean we ignore it
        }
    }
public static void usage ( PrintStream errStream , Object target ) { Class < ? > clazz ; if ( target instanceof Class ) { clazz = ( Class ) target ; } else { clazz = target . getClass ( ) ; } errStream . println ( "Usage: " + clazz . getName ( ) ) ; for ( Class < ? > currentClazz = clazz ; currentClazz != null ; currentClazz = currentClazz . getSuperclass ( ) ) { for ( Field field : currentClazz . getDeclaredFields ( ) ) { fieldUsage ( errStream , target , field ) ; } } try { BeanInfo info = Introspector . getBeanInfo ( clazz ) ; for ( PropertyDescriptor pd : info . getPropertyDescriptors ( ) ) { propertyUsage ( errStream , target , pd ) ; } } catch ( IntrospectionException e ) { // If its not a JavaBean we ignore it } }
Generate usage information based on the target annotations.

@param errStream A {@link java.io.PrintStream} to print the usage information to.
@param target An instance or class.
Generate usage information based on the target annotations .