Package org.int4.dirk.core.store
Class InjectableStore
- java.lang.Object
-
- org.int4.dirk.core.store.InjectableStore
-
- All Implemented Interfaces:
Resolver<Injectable<?>>
public class InjectableStore extends java.lang.Object implements Resolver<Injectable<?>>
A store forInjectables which ensures that it at all times contains only injectables that can be fully resolved.
-
-
Constructor Summary
Constructors Constructor Description InjectableStore(ProxyStrategy proxyStrategy)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Key key)Checks if there is anInjectableassociated with the givenKeyin the store.voidputAll(java.util.Collection<Injectable<?>> injectables)Adds multipleInjectables to the store.voidremoveAll(java.util.Collection<Injectable<?>> injectables)Removes multipleInjectables from the store.java.util.Set<Injectable<?>>resolve(Key key)Look up typesTbyKey.
-
-
-
Constructor Detail
-
InjectableStore
public InjectableStore(ProxyStrategy proxyStrategy)
Constructs a new instance.- Parameters:
proxyStrategy- aProxyStrategy, cannot benull
-
-
Method Detail
-
resolve
public java.util.Set<Injectable<?>> resolve(Key key)
Description copied from interface:ResolverLook up typesTbyKey. The empty set is returned if there were no matches.- Specified by:
resolvein interfaceResolver<Injectable<?>>- Parameters:
key- theKey, cannot benull- Returns:
- a set of type
Ts matching the givenKey, nevernullbut can be empty
-
contains
public boolean contains(Key key)
Checks if there is anInjectableassociated with the givenKeyin the store.- Parameters:
key- theKey, cannot benull- Returns:
trueif there was anInjectableassociated with the givenKey, otherwisefalse
-
putAll
public void putAll(java.util.Collection<Injectable<?>> injectables) throws org.int4.dirk.api.definition.DependencyException
Adds multipleInjectables to the store. If this method throws an exception then the store will be unmodified.- Parameters:
injectables- a collection ofInjectables, cannot benullor containnulls but can be empty- Throws:
org.int4.dirk.api.definition.DependencyException- when adding an injectable would violate store rules
-
removeAll
public void removeAll(java.util.Collection<Injectable<?>> injectables) throws org.int4.dirk.api.definition.DependencyException
Removes multipleInjectables from the store. If this method throws an exception then the store will be unmodified.- Parameters:
injectables- a collection ofInjectables, cannot benullor containnulls but can be empty- Throws:
org.int4.dirk.api.definition.DependencyException- when adding an injectable would violate store rules
-
-