Class ScopeCache<T>

  • Type Parameters:
    T - Type of the cached dependency.


    public class ScopeCache<T>
    extends java.lang.Object
    Class for caching dependencies in a scope.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ScopeCache()
      Constructor for instantiating a ScopeCache
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      T get(DependencyProvider<? extends T> provider)
      Retrieve the cached dependency.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScopeCache

        public ScopeCache()
        Constructor for instantiating a ScopeCache
    • Method Detail

      • get

        public T get(DependencyProvider<? extends T> provider)
        Retrieve the cached dependency.
        If the dependency was already requested before, no new object will be created. On the first call the provided DependencyProvider will be called to create an instance of the dependency.
        Parameters:
        provider - DependencyProvider for initially creating the dependency.
        Returns:
        the requested dependency