/* * Copyright (C) 2014 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.model; import com.google.auto.value.AutoValue; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.CheckReturnValue; import dagger.Provides; import java.util.Optional; import javax.inject.Inject; import javax.lang.model.element.Element; /** * Represents a request for a {@link Key} at an injection point. For example, parameters to {@link * Inject} constructors, {@link Provides} methods, and component methods are all dependency * requests. * *
A dependency request is considered to be synthetic if it does not have
* an {@link Element} in code that requests the key directly. For example, an {@link
* java.util.concurrent.Executor} is required for all {@code @Produces} methods to run
* asynchronously even though it is not directly specified as a parameter to the binding method.
*/
@AutoValue
public abstract class DependencyRequest {
/** The kind of this request. */
public abstract RequestKind kind();
/** The key of this request. */
public abstract Key key();
/**
* The element that declares this dependency request. Absent for synthetic
* requests.
*/
public abstract Optional