<T extends PipelineOptions> T as(Class<T> iface) {
    checkNotNull(iface);
    checkArgument(iface.isInterface(), "Not an interface: %s", iface);

    T existingOption = computedProperties.interfaceToProxyCache.getInstance(iface);
    if (existingOption == null) {
      synchronized (this) {
        // double check
        existingOption = computedProperties.interfaceToProxyCache.getInstance(iface);
        if (existingOption == null) {
          Registration<T> registration =
              PipelineOptionsFactory.CACHE
                  .get()
                  .validateWellFormed(iface, computedProperties.knownInterfaces);
          List<PropertyDescriptor> propertyDescriptors = registration.getPropertyDescriptors();

          Class<T> proxyClass = registration.getProxyClass();

          existingOption =
              InstanceBuilder.ofType(proxyClass)
                  .fromClass(proxyClass)
                  .withArg(InvocationHandler.class, this)
                  .build();

          computedProperties =
              computedProperties.updated(iface, existingOption, propertyDescriptors);
        }
      }
    }
    return existingOption;
  }
@Test
  public void testJsonConversionForContainerTypes() throws Exception {
    List<String> list = ImmutableList.of("a", "b", "c");
    Map<String, String> map = ImmutableMap.of("d", "x", "e", "y", "f", "z");
    Set<String> set = ImmutableSet.of("g", "h", "i");
    ContainerTypes options = PipelineOptionsFactory.as(ContainerTypes.class);
    options.setList(list);
    options.setMap(map);
    options.setSet(set);
    ContainerTypes options2 = serializeDeserialize(ContainerTypes.class, options);
    assertEquals(list, options2.getList());
    assertEquals(map, options2.getMap());
    assertEquals(set, options2.getSet());
  }