1 /** 2 Copyright: 2017 © LLC CERERIS 3 License: MIT 4 Authors: LLC CERERIS 5 */ 6 7 module dich.provider; 8 9 /// Provides objects 10 interface ProviderInterface 11 { 12 public: 13 /** Get object 14 15 Returns: 16 Provided $(D Object) 17 */ 18 Object get(); 19 } 20 21 /// Provides objects for DI 22 class InstanceProvider: ProviderInterface 23 { 24 public: 25 /// Creates an InstanceProvider object 26 this(Object instance) 27 { 28 _instance = instance; 29 } 30 31 /** Get object 32 33 Returns: 34 Provided $(D Object) 35 */ 36 Object get() 37 { 38 return _instance; 39 } 40 41 private: 42 Object _instance; 43 }