/*
* Copyright (C) 2017 The Dagger Authors.
*
* 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 dagger.internal.codegen;
import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.collect.ImmutableList;
import com.google.testing.compile.JavaFileObjects;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.tools.JavaFileObject;
/**
* A fluent API to build a {@link JavaFileObject} appropriate for a current set of settings, such as
* compiler mode.
*
*
After creating a builder, you can add lines to the file. Call {@link #addLines(String...)} to
* add lines irrespective of the settings. If you want to add different lines for different possible
* settings, call {@link #addLinesIf(Object, String...)} to add those lines only if the given
* setting has been added via {@link #withSetting(Object)} or {@link #withSettings(Object...)}.
*/
final class JavaFileBuilder {
private final String qualifiedName;
private final Set