public class Injector extends Object
Modifier and Type | Class | Description |
---|---|---|
static class |
Injector.Key |
Key class for caches
|
Constructor | Description |
---|---|
Injector() |
Default constructor
|
Injector(Injector i) |
Modifier and Type | Method | Description |
---|---|---|
Injector |
bind(Class<?> t,
Class<?> c,
Annotation... annotations) |
Associate a key made of interface type and optional annotations with an implementation type
|
<T> Injector |
bindOneMore(Supplier<T> t,
Class<T> c,
Annotation... annotations) |
Associate a key made of interface type and optional annotations with a supplier of instances,
adding to existing associations
|
<T> Injector |
bindOneMore(T t,
Class<T> c,
Annotation... annotations) |
Associate a key made of interface type and optional annotations with an instance, adding to
existing associations
|
Injector |
bindToOne(Object t,
Class<?> c,
Annotation... annotations) |
Associate a key made of interface type and optional annotations with an instance, replacing
existing associations
|
Injector |
bindToOne(Supplier<?> t,
Class<?> c,
Annotation... annotations) |
Associate a key made of interface type and optional annotations with a supplier of instances,
replacing existing associations
|
<T> T |
getImplementation(Class<T> c,
Annotation... qualifiers) |
|
<T> T |
getImplementation(Class<T> c,
Map<Object,List<Supplier<?>>> overrides,
Annotation... qualifiers) |
|
<T> T |
inject(T t) |
public Injector()
public Injector(Injector i)
i
- injector to copypublic Injector bind(Class<?> t, Class<?> c, Annotation... annotations)
t
- implementation typec
- interface typeannotations
- annotationspublic Injector bindToOne(Object t, Class<?> c, Annotation... annotations)
t
- instancec
- interface typeannotations
- annotationspublic Injector bindToOne(Supplier<?> t, Class<?> c, Annotation... annotations)
t
- supplierc
- interface typeannotations
- annotationspublic <T> Injector bindOneMore(T t, Class<T> c, Annotation... annotations)
t
- instancec
- interface typeannotations
- annotationspublic <T> Injector bindOneMore(Supplier<T> t, Class<T> c, Annotation... annotations)
t
- supplierc
- interface typeannotations
- annotationspublic <T> T inject(T t)
t
- object to injectpublic <T> T getImplementation(Class<T> c, Annotation... qualifiers)
c
- classqualifiers
- optional annotationsCopyright © 2018 The University of Manchester. All rights reserved.