Private _registrationsReturns all registrations for a given base class and key. If key is not provided, will return all registrations for the base class.
Returns the registration with the highest priority for a given base class and key. If key is not provided, will return the registration with the highest priority for the base class.
Returns all registrations that have the specified root class, regardless of what base class was used in the registration. This is useful for finding all registrations in a class hierarchy.
The root class to search for
Optional key to filter results
Array of matching registrations
Use this method or the
A reference to the base class you are registering a sub-class for
A reference to the sub-class you are registering
A key can be used to differentiate registrations for the same base class/sub-class combination. For example, in the case of BaseEntity and Entity object subclasses we'll have a LOT of entries and we want to get the highest priority registered sub-class for a specific key. In that case, the key is the entity name, but the key can be any value you want to use to differentiate registrations.
Higher priority registrations will be used over lower priority registrations. If there are multiple registrations for a given base class/sub-class/key combination, the one with the highest priority will be used. If there are multiple registrations with the same priority, the last one registered will be used. Finally, if you do NOT provide this setting, the order of registrations will increment the priority automatically so dependency injection will typically care care of this. That is, in order for Class B, a subclass of Class A, to be registered properly, Class A code has to already have been loaded and therefore Class A's RegisterClass decorator was run. In that scenario, if neither Class A or B has a priority setting, Class A would be 1 and Class B would be 2 automatically. For this reason, you only need to explicitly set priority if you want to do something atypical as this mechanism normally will solve for setting the priority correctly based on the furthest descendant class that is registered.
If true, will not print a warning if the key is null or undefined. This is useful for cases where you know that the key is not needed and you don't want to see the warning in the console.
If true (default), will automatically register the subclass with the root class of the baseClass hierarchy. This ensures proper priority ordering when multiple subclasses are registered in a hierarchy.
decorator to register a sub-class for a given base class.
ClassFactory is used to register and create instances of classes. It is a singleton class that can be used to register a sub-class for a given base class and key. Do NOT directly attempt to instantiate this class, instead use the static Instance property of the MJGlobal class to get the instance of the ClassFactory for your application.