Interface InjectAssignment


public interface InjectAssignment
Provides customized assignments for injected types.

When supporting third party injection frameworks (such as Jakarta Inject - JSR-330), it is quite easy to map annotations to Helidon equivalents, but we also need to support some prescribed types for injection. For example in Jakarta we need to support Provider type (same as Supplier, just predates its existence). As we need to assign the correct type to injection points, and it must behave similar to our Service provider, we need to provide source code mapping from Supplier to the type (always three: plain type, Optional type, and a List of types).

  • Method Details

    • assignment

      Optional<InjectAssignment.Assignment> assignment(TypeName typeName, String valueSource)
      Map the type to the correct one.
      Parameters:
      typeName - type of the processed injection point, may be a generic type such as List, Optional (these are the types expected to be supported)
      valueSource - code that obtains value from Helidon Service Registry (if this method returns a non-empty optional, the provided value will be an Optional Supplier, List of Supplier, or a Supplier as returned by the InjectAssignment.Assignment.usedType(); other type combinations are not supported
      Returns:
      assignment to use, or an empty assignment if this provider does not understand the type