/*
 * Copyright 2017, Google Inc.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *     http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.opencensus.tags;

import javax.annotation.concurrent.Immutable;

/**
 * Object for creating new {@link TagContext}s.
 *
 * <p>This class returns {@link TagContextBuilder builders} that can be used to create the
 * implementation-dependent {@link TagContext}s.
 */
public abstract class TagContexts {
  private static final TagContexts NOOP_TAG_CONTEXTS = new NoopTagContexts();

  /**
   * Returns an empty {@code TagContext}.
   *
   * @return an empty {@code TagContext}.
   */
  public abstract TagContext empty();

  /**
   * Returns a new empty {@code Builder}.
   *
   * @return a new empty {@code Builder}.
   */
  public abstract TagContextBuilder emptyBuilder();

  /**
   * Returns a builder based on this {@code TagContext}.
   *
   * @return a builder based on this {@code TagContext}.
   */
  public abstract TagContextBuilder toBuilder(TagContext tags);

  /**
   * Returns a {@code TagContexts} that only produces {@link TagContext}s with no tags.
   *
   * @return a {@code TagContexts} that only produces {@code TagContext}s with no tags.
   */
  static TagContexts getNoopTagContexts() {
    return NOOP_TAG_CONTEXTS;
  }

  @Immutable
  private static final class NoopTagContexts extends TagContexts {

    @Override
    public TagContext empty() {
      return TagContext.getNoopTagContext();
    }

    @Override
    public TagContextBuilder emptyBuilder() {
      return TagContextBuilder.getNoopTagContextBuilder();
    }

    @Override
    public TagContextBuilder toBuilder(TagContext tags) {
      return TagContextBuilder.getNoopTagContextBuilder();
    }
  }
}

@@ -1217,33 +1217,24 @@
 */%0A  public 
-abstract 
 TagContextBu
@@ -1253,17 +1253,53 @@
 uilder()
-;
+ %7B%0A    return toBuilder(empty());%0A  %7D
 %0A%0A  /**%0A
@@ -1943,134 +1943,8 @@
  %7D%0A%0A
-    @Override%0A    public TagContextBuilder emptyBuilder() %7B%0A      return TagContextBuilder.getNoopTagContextBuilder();%0A    %7D%0A%0A
     

Add default implementation of TagContexts.emptyBuilder().