Class DI


  • public final class DI
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.Class<?>,​java.lang.Object> singletonInstances  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> void addSingletonInstance​(java.lang.Class<T> key, T instance)
      Return the instance of a singleton if it exists, null otherwise
      static DI getInstance()  
      <T> T getSingletonInstance​(java.lang.Class<T> key)
      Return the instance of a singleton if it exists, null otherwise
      static void reset()  
      • Methods inherited from class java.lang.Object

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

      • singletonInstances

        protected java.util.Map<java.lang.Class<?>,​java.lang.Object> singletonInstances
    • Method Detail

      • getInstance

        public static DI getInstance()
      • reset

        public static void reset()
      • getSingletonInstance

        @Nullable
        public <T> T getSingletonInstance​(java.lang.Class<T> key)
        Return the instance of a singleton if it exists, null otherwise
        Type Parameters:
        T -
        Parameters:
        key -
        Returns:
      • addSingletonInstance

        @Nullable
        public <T> void addSingletonInstance​(java.lang.Class<T> key,
                                             T instance)
        Return the instance of a singleton if it exists, null otherwise
        Type Parameters:
        T -
        Parameters:
        key -