org.glassfish.hk2.api
Interface InjectionResolver<T>

Type Parameters:
T - This must be the class of the injection annotation that this resolver will handle
All Known Implementing Classes:
AlternateInjectResolver, ThreeThirtyResolver

@Contract
public interface InjectionResolver<T>

This class allows users to provide a custom injection target for any annotation (including @Inject). The user would usually only provide a resolver for @Inject if it were specializing the system provided resolver for @Inject. Otherwise, this resolver can be used to provide injection points for any annotation.

An implementation of Context must be in the Singleton scope

Author:
jwells

Field Summary
static String SYSTEM_RESOLVER_NAME
          This is the name of the system provided resolver for 330 injections
 
Method Summary
 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.
 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.
 Object resolve(Injectee injectee, ServiceHandle<?> root)
          This method will return the object that should be injected into the given injection point.
 

Field Detail

SYSTEM_RESOLVER_NAME

static final String SYSTEM_RESOLVER_NAME
This is the name of the system provided resolver for 330 injections

See Also:
Constant Field Values
Method Detail

resolve

Object resolve(Injectee injectee,
               ServiceHandle<?> root)
This method will return the object that should be injected into the given injection point. It is the responsiblity 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
root - The service handle of the root class being created, which should be used in order to ensure proper destruction of associated &64;PerLookup scoped objects. This can be null in the case that this is being used for an object not managed by HK2. This will only happen if this object is being created with the create method of ServiceLocator.
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


Copyright © 2013 Oracle Corporation. All Rights Reserved.