Module org.update4j

Interface Injectable

All Known Subinterfaces:
Delegate, Launcher, Service, UpdateHandler
All Known Implementing Classes:
DefaultBootstrap, DefaultLauncher, DefaultUpdateHandler

public interface Injectable
A class implementing this type can be scanned to send and receive fields to and from another injectable. A field annotated with InjectSource will send its value to a matching field annotated with InjectTarget.

An inject target field that has not set required to false must find a matching inject source, otherwise an UnsatisfiedInjectionException will be thrown. An inject source that doesn't have a matching target will not fail.

A target is matched with a source by matching the field names. You may also explicitly set the target field name with target in InjectSource. It will not look in the class hierarchy, only the object type class itself. It is illegal for 2 fields to map to the same target.

Fields containing both InjectSource and InjectTarget at once is valid, and can be used to swap values between the 2 injectables,

You can annotate a method with PostInject to register a callback once injection completes. Optionally, if the first parameter type is assignable to the other injectable, it will be passed.

Author:
Mordechai Meisels