Interface InjectionResolver<T extends Annotation>

Type Parameters:
T - This must be the annotation class of the injection annotation that this resolver will handle.
All Known Subinterfaces:
ContextInjectionResolver
All Known Implementing Classes:
ContextInjectionResolverImpl, ContextInjectionResolverImpl, ParamInjectionResolver

public interface InjectionResolver<T extends Annotation>
This class allows users to provide a custom injection target for any annotation (including &#64;Inject). The user would usually only provide a resolver for &#64;Inject if it were specializing the system provided resolver for &#64;Inject. Otherwise, this resolver can be used to provide injection points for any annotation.

Jersey provides all InjectionResolvers for JAX-RS annotation and org.glassfish.jersey.server.Uri apart from Context which must be implemented and registered directly as a part of DI integration because of many optimization which cannot be implemented on Jersey side.

The InjectionResolvers are delivered to DI integration using InjectionManager.register(Binder) and DI provider just filter InjectionResolverBinding and internally register the annotation handling using its own mechanism.

  • Method Summary

    Modifier and Type
    Method
    Description
    This method returns the annotation for what the injection resolver is implemented.
    boolean
    This method should return true if the annotation that indicates that this is an injection point can appear in the parameter list of a constructor.
    boolean
    This method should return true if the annotation that indicates that this is an injection point can appear in the parameter list of a method.
    resolve(Injectee injectee)
    This method will return the object that should be injected into the given injection point.
  • Method Details

    • resolve

      Object resolve(Injectee injectee)
      This method will return the object that should be injected into the given injection point. It is the responsibility of the implementation to ensure that the object returned can be safely injected into the injection point.

      This method should not do the injection themselves.

      Parameters:
      injectee - The injection point this value is being injected into
      Returns:
      A possibly null value to be injected into the given injection point
    • isConstructorParameterIndicator

      boolean isConstructorParameterIndicator()
      This method should return true if the annotation that indicates that this is an injection point can appear in the parameter list of a constructor.
      Returns:
      true if the injection annotation can appear in the parameter list of a constructor.
    • isMethodParameterIndicator

      boolean isMethodParameterIndicator()
      This method should return true if the annotation that indicates that this is an injection point can appear in the parameter list of a method.
      Returns:
      true if the injection annotation can appear in the parameter list of a method.
    • getAnnotation

      Class<T> getAnnotation()
      This method returns the annotation for what the injection resolver is implemented.
      Returns:
      handled annotation by injection resolver.