Package dagger.spi.model
Class Key
- java.lang.Object
-
- dagger.spi.model.Key
-
public abstract class Key extends java.lang.ObjectA type and an optional qualifier that is the lookup key for a binding.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKey.BuilderA builder forKeys.static classKey.MultibindingContributionIdentifierAn object that identifies a multibinding contribution method and the module class that contributes it to the graph.
-
Constructor Summary
Constructors Constructor Description Key()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Key.Builderbuilder(DaggerType type)Returns a builder forKeys.abstract booleanequals(java.lang.Object o)abstract inthashCode()abstract java.util.Optional<Key.MultibindingContributionIdentifier>multibindingContributionIdentifier()Distinguishes keys for multibinding contributions that share atype()andqualifier().abstract java.util.Optional<DaggerAnnotation>qualifier()AQualifierannotation that provides a unique namespace prefix for the type of this key.java.lang.StringtoString()abstract DaggerTypetype()The type represented by this key.KeywithMultibindingContributionIdentifier(DaggerTypeElement contributingModule, DaggerExecutableElement bindingMethod)Returns a copy of this key with the multibinding contribution identifier replaced with the given multibinding contribution identifier.KeywithoutMultibindingContributionIdentifier()Returns a copy of this key with the multibinding contribution identifier, if any, removed.KeywithType(DaggerType newType)Returns a copy of this key with the type replaced with the given type.
-
-
-
Method Detail
-
qualifier
public abstract java.util.Optional<DaggerAnnotation> qualifier()
AQualifierannotation that provides a unique namespace prefix for the type of this key.
-
type
public abstract DaggerType type()
The type represented by this key.
-
multibindingContributionIdentifier
public abstract java.util.Optional<Key.MultibindingContributionIdentifier> multibindingContributionIdentifier()
Distinguishes keys for multibinding contributions that share atype()andqualifier().Each multibound map and set has a synthetic multibinding that depends on the specific contributions to that map or set using keys that identify those multibinding contributions.
Absent except for multibinding contributions.
-
withType
public Key withType(DaggerType newType)
Returns a copy of this key with the type replaced with the given type.
-
withMultibindingContributionIdentifier
public Key withMultibindingContributionIdentifier(DaggerTypeElement contributingModule, DaggerExecutableElement bindingMethod)
Returns a copy of this key with the multibinding contribution identifier replaced with the given multibinding contribution identifier.
-
withoutMultibindingContributionIdentifier
public Key withoutMultibindingContributionIdentifier()
Returns a copy of this key with the multibinding contribution identifier, if any, removed.
-
hashCode
@Memoized public abstract int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public abstract boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
builder
public static Key.Builder builder(DaggerType type)
Returns a builder forKeys.
-
-