T - The type of the keypublic final class Key<T>
extends java.lang.Object
implements java.io.Serializable
TypeReference representing the type of the key,
and a Set of Qualifier representing the annotations or
annotation types that works like qualifiers.
The key supports generic types using TypeReference, the key
cannot be created using a sub-class like TypeReference.
| Constructor and Description |
|---|
Key(TypeReference<T> type,
java.lang.Class<? extends java.lang.annotation.Annotation> qualifierType,
java.lang.annotation.Annotation qualifier) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
java.lang.annotation.Annotation |
getQualifier()
Returns the qualifier instance attached
to this type key
|
java.lang.Class<? extends java.lang.annotation.Annotation> |
getQualifierType()
Returns the qualifier type attached
to this type key
|
TypeReference<T> |
getType() |
int |
hashCode() |
boolean |
isPureRawType()
Determines if the
Key represented by this is a raw-type |
static <T> Key<T> |
of(java.lang.Class<T> type) |
static <T> Key<T> |
of(TypeReference<T> type) |
static <T> Key<T> |
of(TypeReference<T> type,
java.lang.Class<? extends java.lang.annotation.Annotation> qualifierType,
java.lang.annotation.Annotation qualifier) |
boolean |
requiresContext()
Checks if the wrapped type requires context or not
|
java.lang.String |
toString()
This should create a string with util information
and very verbose.
|
Key<T> |
withQualifier(java.lang.annotation.Annotation qualifier)
Returns a new
Key with the given qualifier |
Key<T> |
withQualifier(java.lang.Class<? extends java.lang.annotation.Annotation> qualifierType)
Returns a new
Key with the given qualifierType |
<R> Key<R> |
withType(TypeReference<R> type)
Returns a new
Key instance with the
given type, the qualifier is copied |
public Key(TypeReference<T> type, java.lang.Class<? extends java.lang.annotation.Annotation> qualifierType, java.lang.annotation.Annotation qualifier)
public static <T> Key<T> of(java.lang.Class<T> type)
public static <T> Key<T> of(TypeReference<T> type)
public static <T> Key<T> of(TypeReference<T> type, java.lang.Class<? extends java.lang.annotation.Annotation> qualifierType, java.lang.annotation.Annotation qualifier)
public boolean isPureRawType()
Key represented by this is a raw-typetrue if the Key represented by this is a raw-typepublic boolean requiresContext()
true if the wrapped type requires contextpublic TypeReference<T> getType()
public java.lang.annotation.Annotation getQualifier()
public java.lang.Class<? extends java.lang.annotation.Annotation> getQualifierType()
public <R> Key<R> withType(TypeReference<R> type)
Key instance with the
given type, the qualifier is copiedR - The new key typetype - The new key typepublic Key<T> withQualifier(java.lang.annotation.Annotation qualifier)
Key with the given qualifierqualifier - The new qualifierpublic Key<T> withQualifier(java.lang.Class<? extends java.lang.annotation.Annotation> qualifierType)
Key with the given qualifierTypequalifierType - The new qualifier typepublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
team.unnamed.inject.ExampleType
annotated with @Named("hello")
marked with @Marker
If a class name starts with java,
it isn't used, the used name is now Class.getSimpleName()toString in class java.lang.Object