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).
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Assignment for code generation. -
Method Summary
Modifier and TypeMethodDescriptionassignment
(TypeName typeName, String valueSource) Map the type to the correct one.
-
Method Details
-
assignment
Map the type to the correct one.- Parameters:
typeName
- type of the processed injection point, may be a generic type such asList
,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 anOptional
Supplier
,List
ofSupplier
, or aSupplier
as returned by theInjectAssignment.Assignment.usedType()
; other type combinations are not supported- Returns:
- assignment to use, or an empty assignment if this provider does not understand the type
-