Package org.apache.maven.di
Class Key<T>
java.lang.Object
org.apache.maven.di.Key<T>
- Type Parameters:
- T- binding type
The key defines an identity of a binding. In any DI, a key is usually a type of the object along
 with some optional tag to distinguish between bindings which make objects of the same type.
 
In Maven Inject, a key is also a type token - special abstract class that can store type information with the shortest syntax possible in Java.
 For example, to create a key of type Map<String, List<Integer>>, you can just use
 this syntax: new Key<Map<String, List<Integer>>>(){}.
 
 If your types are not known at compile time, you can use Types.parameterizedType(java.lang.reflect.Type, java.lang.reflect.Type, java.lang.reflect.Type[]) to make a
 parameterized type and give it to a Key.ofType constructor.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturns an underlying type with display string formatting (package names stripped) and prepended qualifier display string if this key has a qualifier.A shortcut forTypes.getRawType(Type)(key.getType())getType()<U> Key<U> getTypeParameter(int index) Returns a type parameter of the underlying type wrapped as a key with no qualifier.inthashCode()static <T> Key<T> static <T> Key<T> static <T> Key<T> static <T> Key<T> toString()
- 
Constructor Details- 
Keyprotected Key()
- 
Key
- 
Key
 
- 
- 
Method Details- 
of
- 
of
- 
ofType
- 
ofType
- 
getType
- 
getRawTypeA shortcut forTypes.getRawType(Type)(key.getType())
- 
getTypeParameterReturns a type parameter of the underlying type wrapped as a key with no qualifier.- Throws:
- IllegalStateException- when underlying type is not a parameterized one.
 
- 
getQualifier
- 
getDisplayStringReturns an underlying type with display string formatting (package names stripped) and prepended qualifier display string if this key has a qualifier.
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
 
-