static Set<PipelineOptionSpec> getOptionSpecs(
      Class<? extends PipelineOptions> optionsInterface, boolean skipHidden) {
    Iterable<Method> methods = ReflectHelpers.getClosureOfMethodsOnInterface(optionsInterface);
    Multimap<String, Method> propsToGetters = getPropertyNamesToGetters(methods);

    ImmutableSet.Builder<PipelineOptionSpec> setBuilder = ImmutableSet.builder();
    for (Map.Entry<String, Method> propAndGetter : propsToGetters.entries()) {
      String prop = propAndGetter.getKey();
      Method getter = propAndGetter.getValue();

      @SuppressWarnings("unchecked")
      Class<? extends PipelineOptions> declaringClass =
          (Class<? extends PipelineOptions>) getter.getDeclaringClass();

      if (!PipelineOptions.class.isAssignableFrom(declaringClass)) {
        continue;
      }

      if (skipHidden && declaringClass.isAnnotationPresent(Hidden.class)) {
        continue;
      }

      setBuilder.add(PipelineOptionSpec.of(declaringClass, prop, getter));
    }

    return setBuilder.build();
  }
@Test
  public void testExcludesNonPipelineOptionsMethods() {
    Set<PipelineOptionSpec> properties =
        PipelineOptionsReflector.getOptionSpecs(ExtendsNonPipelineOptions.class, true);

    assertThat(properties, not(hasItem(hasName("foo"))));
  }