Method Name |
Function |
Injector (xmlConfig: XML = null) |
The constructor initializes some private variables of the injector, IF configured through xml. Write in the parameter. In this way, the injector is set to the xml configuration mode. |
MapValue (whenAskedFor: Class, useValue: Object, named: String = ""):* |
Value ing. Map the full name of a request [class + # + injection name] to an existing object. |
MapClass (whenAskedFor: Class, instantiateClass: Class, named: String = ""):* |
Class ing: maps the full name of a request [class + # + injection name] to a class.Note that the ing class can be unrelated to the requested class. |
MapSingleton ( WhenAskedFor: Class, named: String = ""):* |
Singleton ing maps the full name of a request [class + # + injection name] to a singleton object of the class. |
MapSingletonOf ( WhenAskedFor: Class, useSingletonOf: Class, named: String = ""):* |
Singleton class ing maps the full name of one request [class + # + injection name] To the singleton object of another class.Note that the ing class can be unrelated to the requested class. |
MapRule (whenAskedFor: Class, useRule: *, named: String = ""):* |
Rule ing. Map the full name of a request [class + # + injection name] To the return policy of another injection configuration (I personally think this method does not work. It is better to set the second parameter to a custom InjectionResult. This also increases scalability) |
GetMapping (WhenAskedFor: Class, named: String = "") |
Obtain the corresponding injection configuration according to the request. If the corresponding injection configuration already exists, it is directly returned from the mappings cache. If not, a new injection configuration will be created. And save it in mapping. |
InjectInto (target: Object): void |
Inject dependencies into the target object. (Only include property injection and method injection ). Constructor injection is completed when the target object is generated. |
Instantiate (clazz: Class ):* |
Instantiate a class. The class is created by using the constructor injection method, and then the injectInto method is called to complete the dependency injection of this object. Finally, the injected object is returned. |
Unmap (clazz: Class, named: String = ""):* |
Unbind A ing. Internally, the InjectionConfig Return Policy of the ing is set to null. (In my opinion, you should also delete the references in mapping ). |
HasMapping (clazz: Class, named: String = ''): Boolean |
InjectionConfig) |
GetInstance (clazz: Class, named: String = ''):* |
Return the corresponding instance according to the request. All dependency injection has been completed for this instance. |
CreateChildInjector (applicationDomain: ApplicationDomain = null): Injector |
Create a sub-Injector |
SetApplicationDomain (applicationDomain: ApplicationDomain): void |
Set the application domain of the injector |
GetApplicationDomain (): ApplicationDomain |
Get the application domain of the injector |
SetParentInjector (parentInjector: Injector) |
Set the parent Injector of the injector |
GetParentInjector (): Injector |
Obtain the parent Injector of the injector. |
PurgeInjectionPointsCache () |
Clear the injection point cache. |