Class InjectableStore

  • All Implemented Interfaces:
    Resolver<Injectable<?>>

    public class InjectableStore
    extends java.lang.Object
    implements Resolver<Injectable<?>>
    A store for Injectables which ensures that it at all times contains only injectables that can be fully resolved.
    • Constructor Detail

      • InjectableStore

        public InjectableStore​(ProxyStrategy proxyStrategy)
        Constructs a new instance.
        Parameters:
        proxyStrategy - a ProxyStrategy, cannot be null
    • Method Detail

      • resolve

        public java.util.Set<Injectable<?>> resolve​(Key key)
        Description copied from interface: Resolver
        Look up types T by Key. The empty set is returned if there were no matches.
        Specified by:
        resolve in interface Resolver<Injectable<?>>
        Parameters:
        key - the Key, cannot be null
        Returns:
        a set of type Ts matching the given Key, never null but can be empty
      • contains

        public boolean contains​(Key key)
        Checks if there is an Injectable associated with the given Key in the store.
        Parameters:
        key - the Key, cannot be null
        Returns:
        true if there was an Injectable associated with the given Key, otherwise false
      • putAll

        public void putAll​(java.util.Collection<Injectable<?>> injectables)
                    throws org.int4.dirk.api.definition.DependencyException
        Adds multiple Injectables to the store. If this method throws an exception then the store will be unmodified.
        Parameters:
        injectables - a collection of Injectables, cannot be null or contain nulls 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 multiple Injectables from the store. If this method throws an exception then the store will be unmodified.
        Parameters:
        injectables - a collection of Injectables, cannot be null or contain nulls but can be empty
        Throws:
        org.int4.dirk.api.definition.DependencyException - when adding an injectable would violate store rules