Package io.bootique.di
Class Key<T>
java.lang.Object
io.bootique.di.Key<T>
An object that encapsulates a key used to store and lookup DI bindings. Key is made of
a binding type and an optional qualifier (name or annotation).
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedKey(TypeLiteral<T> type, Annotation annotationInstance) protectedKey(TypeLiteral<T> type, Class<? extends Annotation> annotationType) protectedKey(TypeLiteral<T> type, String bindingName) -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <T> Key<T>get(TypeLiteral<T> typeLiteral) static <T> Key<T>get(TypeLiteral<T> typeLiteral, Annotation annotationInstance) static <T> Key<T>get(TypeLiteral<T> typeLiteral, Class<? extends Annotation> annotationType) static <T> Key<T>get(TypeLiteral<T> typeLiteral, String bindingName) static <T> Key<T>Creates a key for a nameless binding of a given type.static <T> Key<T>get(Class<T> type, Annotation annotationInstance) static <T> Key<T>get(Class<T> type, Class<? extends Annotation> annotationType) Creates a key for a qualified by annotation binding of a given type.static <T> Key<T>Creates a key for a named binding of a given type.Class<? extends Annotation>Returns an optional name of the binding used to distinguish multiple bindings of the same object type.getListOf(Class<T> type, Class<? extends Annotation> qualifier) getMapOf(TypeLiteral<K> keyType, TypeLiteral<V> valueType) getMapOf(TypeLiteral<K> keyType, TypeLiteral<V> valueType, Class<? extends Annotation> qualifier) getMapOf(TypeLiteral<K> keyType, TypeLiteral<V> valueType, String bindingName) getMapOf(Class<K> keyType, Class<V> valueType, Class<? extends Annotation> qualifier) getOptionalOf(Key<T> key) Creates Optional<T> version of given keygetOptionalOf(Class<? extends T> type) getSetOf(Class<T> valueType, Class<? extends Annotation> qualifier) getType()inthashCode()toString()
-
Constructor Details
-
Key
-
Key
-
Key
-
-
Method Details
-
get
Creates a key for a nameless binding of a given type. -
get
Creates a key for a named binding of a given type. 'bindingName' that is an empty String is treated the same way as a null 'bindingName'. In both cases a nameless binding key is created. -
get
Creates a key for a qualified by annotation binding of a given type. -
get
-
get
-
get
-
get
public static <T> Key<T> get(TypeLiteral<T> typeLiteral, Class<? extends Annotation> annotationType) -
get
-
getListOf
-
getListOf
-
getListOf
-
getSetOf
-
getSetOf
-
getSetOf
-
getMapOf
-
getMapOf
-
getMapOf
-
getMapOf
public static <K,V> Key<Map<K,V>> getMapOf(TypeLiteral<K> keyType, TypeLiteral<V> valueType, Class<? extends Annotation> qualifier) -
getMapOf
public static <K,V> Key<Map<K,V>> getMapOf(TypeLiteral<K> keyType, TypeLiteral<V> valueType, String bindingName) -
getMapOf
-
getOptionalOf
-
getOptionalOf
Creates Optional<T> version of given key -
getType
-
getBindingName
Returns an optional name of the binding used to distinguish multiple bindings of the same object type. -
getBindingAnnotation
-
equals
-
hashCode
public int hashCode() -
toString
-