public static void printHelp()

in sdk/src/main/java/com/google/cloud/dataflow/sdk/options/PipelineOptionsFactory.java [658:714]


  public static void printHelp(PrintStream out, Class<? extends PipelineOptions> iface) {
    Preconditions.checkNotNull(out);
    Preconditions.checkNotNull(iface);
    validateWellFormed(iface, REGISTERED_OPTIONS);

    Iterable<Method> methods = ReflectHelpers.getClosureOfMethodsOnInterface(iface);
    ListMultimap<Class<?>, Method> ifaceToMethods = ArrayListMultimap.create();
    for (Method method : methods) {
      // Process only methods that are not marked as hidden.
      if (method.getAnnotation(Hidden.class) == null) {
        ifaceToMethods.put(method.getDeclaringClass(), method);
      }
    }
    SortedSet<Class<?>> ifaces = new TreeSet<>(ClassNameComparator.INSTANCE);
    // Keep interfaces that are not marked as hidden.
    ifaces.addAll(Collections2.filter(ifaceToMethods.keySet(), new Predicate<Class<?>>() {
      @Override
      public boolean apply(Class<?> input) {
        return input.getAnnotation(Hidden.class) == null;
      }
    }));
    for (Class<?> currentIface : ifaces) {
      Map<String, Method> propertyNamesToGetters =
          getPropertyNamesToGetters(ifaceToMethods.get(currentIface));

      // Don't output anything if there are no defined options
      if (propertyNamesToGetters.isEmpty()) {
        continue;
      }
      SortedSetMultimap<String, String> requiredGroupNameToProperties =
          getRequiredGroupNamesToProperties(propertyNamesToGetters);

      out.format("%s:%n", currentIface.getName());
      prettyPrintDescription(out, currentIface.getAnnotation(Description.class));

      out.println();

      List<String> lists = Lists.newArrayList(propertyNamesToGetters.keySet());
      Collections.sort(lists, String.CASE_INSENSITIVE_ORDER);
      for (String propertyName : lists) {
        Method method = propertyNamesToGetters.get(propertyName);
        String printableType = method.getReturnType().getSimpleName();
        if (method.getReturnType().isEnum()) {
          printableType = Joiner.on(" | ").join(method.getReturnType().getEnumConstants());
        }
        out.format("  --%s=<%s>%n", propertyName, printableType);
        Optional<String> defaultValue = getDefaultValueFromAnnotation(method);
        if (defaultValue.isPresent()) {
          out.format("    Default: %s%n", defaultValue.get());
        }
        prettyPrintDescription(out, method.getAnnotation(Description.class));
        prettyPrintRequiredGroups(out, method.getAnnotation(Validation.Required.class),
            requiredGroupNameToProperties);
      }
      out.println();
    }
  }