Class Injector

Direct Known Subclasses:
GuiceComponentInjector, SpringComponentInjector

public abstract class Injector extends Object
Injector scans fields of an object instance and checks if the specified IFieldValueFactory can provide a value for a field; if it can, the field is set to that value. Injector will ignore all non-null fields.
Igor Vaynberg (ivaynberg)
  • Constructor Details

  • Method Details

    • bind

      public void bind(Application application)
      Binds current instance of the injector to the Application. After this method is called this instance of injector will be returned from subsequent calls to get() whenever the specified application object is active in the thread.
      application -
    • get

      public static Injector get()
      Injector associated with the application instance
    • inject

      public abstract void inject(Object object)
      Injects the specified object. This method is usually implemented by delegating to inject(Object, IFieldValueFactory) with some IFieldValueFactory
      object -
      See Also:
    • inject

      protected void inject(Object object, IFieldValueFactory factory)
      traverse fields in the class hierarchy of the object and set their value with a locator provided by the locator factory.
      object -
      factory -