Package org.semanticweb.owlapi.utilities
Class Injector
java.lang.Object
org.semanticweb.owlapi.utilities.Injector
Basic dependency injection utility, to replace the use of Guice and wrap calls to ServiceLoader.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbind
(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 associationsbindToOne
(Object t, Class<?> c, Annotation... annotations) Associate a key made of interface type and optional annotations with an instance, replacing existing associationsbindToOne
(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
getImplementation
(Class<T> c, OntologyConfigurator v, Annotation... qualifiers) <T> T
inject
(T t)
-
Constructor Details
-
Injector
public Injector()Default constructor -
Injector
- Parameters:
i
- injector to copy
-
-
Method Details
-
bind
Associate a key made of interface type and optional annotations with an implementation type- Parameters:
t
- implementation typec
- interface typeannotations
- annotations- Returns:
- modified injector
-
bindToOne
Associate a key made of interface type and optional annotations with an instance, replacing existing associations- Parameters:
t
- instancec
- interface typeannotations
- annotations- Returns:
- modified injector
-
bindToOne
Associate a key made of interface type and optional annotations with a supplier of instances, replacing existing associations- Parameters:
t
- supplierc
- interface typeannotations
- annotations- Returns:
- modified injector
-
bindOneMore
Associate a key made of interface type and optional annotations with an instance, adding to existing associations- Type Parameters:
T
- type- Parameters:
t
- instancec
- interface typeannotations
- annotations- Returns:
- modified injector
-
bindOneMore
Associate a key made of interface type and optional annotations with a supplier of instances, adding to existing associations- Type Parameters:
T
- type- Parameters:
t
- supplierc
- interface typeannotations
- annotations- Returns:
- modified injector
-
inject
public <T> T inject(T t) - Type Parameters:
T
- type- Parameters:
t
- object to inject- Returns:
- input object with all methods annotated with @Inject having been set with instances.
-
getImplementation
- Type Parameters:
T
- type- Parameters:
c
- classqualifiers
- optional annotations- Returns:
- instance
-
getImplementation
- Type Parameters:
T
- type- Parameters:
c
- classv
- configuration optionsqualifiers
- optional annotations- Returns:
- instance
-
getImplementation
public <T> T getImplementation(Class<T> c, Map<Object, List<Supplier<?>>> overrides, Annotation... qualifiers) - Type Parameters:
T
- type- Parameters:
c
- classoverrides
- local overrides of existing bindingsqualifiers
- optional annotations- Returns:
- instance
-