Interface Injector


  • @ConsumerType
    public interface Injector
    Service interface for pluggable value injectors.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      @NotNull java.lang.String getName()
      Return a logical name for the injector.
      @Nullable java.lang.Object getValue​(@NotNull java.lang.Object adaptable, java.lang.String name, @NotNull java.lang.reflect.Type declaredType, @NotNull java.lang.reflect.AnnotatedElement element, @NotNull DisposalCallbackRegistry callbackRegistry)
      Produce a value for an injection point.
    • Method Detail

      • getName

        @NotNull
        @NotNull java.lang.String getName()
        Return a logical name for the injector. Used in resolving
        @Source
        annotations.
        Returns:
        the injector's name
      • getValue

        @Nullable
        @Nullable java.lang.Object getValue​(@NotNull
                                            @NotNull java.lang.Object adaptable,
                                            java.lang.String name,
                                            @NotNull
                                            @NotNull java.lang.reflect.Type declaredType,
                                            @NotNull
                                            @NotNull java.lang.reflect.AnnotatedElement element,
                                            @NotNull
                                            @NotNull DisposalCallbackRegistry callbackRegistry)
        Produce a value for an injection point.
        Parameters:
        adaptable - the object which should be used as the basis for value resolution.
        name - the injection point name (may be only null if injector implements the AcceptsNullName interface, otherwise never null)
        declaredType - the declared type of the injection point
        element - the injection point itself
        callbackRegistry - a registry object to register a callback object which will be invoked when the adapted object is disposed.
        Returns:
        the value to be injected or null if no value could be resolved