| OLD | NEW |
| (Empty) |
| 1 part of di; | |
| 2 | |
| 3 abstract class Injector { | |
| 4 /** | |
| 5 * Name of the injector or null of none is given. | |
| 6 */ | |
| 7 String get name; | |
| 8 | |
| 9 /** | |
| 10 * The parent injector or null if root. | |
| 11 */ | |
| 12 Injector get parent; | |
| 13 | |
| 14 /** | |
| 15 * The root injector. | |
| 16 */ | |
| 17 Injector get root; | |
| 18 | |
| 19 /** | |
| 20 * List of all types which the injector can return | |
| 21 */ | |
| 22 Set<Type> get types; | |
| 23 | |
| 24 /** | |
| 25 * Indicates whether injector allows implicit injection -- resolving types | |
| 26 * that were not explicitly bound in the module(s). | |
| 27 */ | |
| 28 bool get allowImplicitInjection; | |
| 29 | |
| 30 /** | |
| 31 * Get an instance for given token ([Type]). | |
| 32 * | |
| 33 * If the injector already has an instance for this token, it returns this | |
| 34 * instance. Otherwise, injector resolves all its dependencies, instantiates | |
| 35 * new instance and returns this instance. | |
| 36 * | |
| 37 * If there is no binding for given token, injector asks parent injector. | |
| 38 * | |
| 39 * If there is no parent injector, an implicit binding is used. That is, | |
| 40 * the token ([Type]) is instantiated. | |
| 41 */ | |
| 42 dynamic get(Type type, [Type annotation]); | |
| 43 | |
| 44 /** | |
| 45 * Get an instance for given key ([Key]). | |
| 46 * | |
| 47 * If the injector already has an instance for this key, it returns this | |
| 48 * instance. Otherwise, injector resolves all its dependencies, instantiates | |
| 49 * new instance and returns this instance. | |
| 50 * | |
| 51 * If there is no binding for given key, injector asks parent injector. | |
| 52 */ | |
| 53 dynamic getByKey(Key key); | |
| 54 | |
| 55 /** | |
| 56 * Create a child injector. | |
| 57 * | |
| 58 * Child injector can override any bindings by adding additional modules. | |
| 59 * | |
| 60 * It also accepts a list of tokens that a new instance should be forced. | |
| 61 * That means, even if some parent injector already has an instance for this | |
| 62 * token, there will be a new instance created in the child injector. | |
| 63 */ | |
| 64 Injector createChild(List<Module> modules, | |
| 65 {List forceNewInstances, String name}); | |
| 66 } | |
| OLD | NEW |