Top Description Fields Constructors Methods
org.glassfish.hk2.utilities

public Class GreedyResolver

extends Object
implements JustInTimeInjectionResolver
Class Inheritance
All Implemented Interfaces
org.glassfish.hk2.api.JustInTimeInjectionResolver
Annotations
@Singleton
@Visibility:LOCAL
Imports
java.lang.reflect.ParameterizedType, .Type, jakarta.inject.Inject, .Singleton, org.glassfish.hk2.api.DescriptorVisibility, .Injectee, .JustInTimeInjectionResolver, .ServiceLocator, .Visibility

This is a greedy resolve that will add in any class that has failed to be resolved. It uses ServiceLocatorUtilities#addClasses(org.glassfish.hk2.api.ServiceLocator, Class...) in order to add classes, and hence will use the default class analyzer to discover injection points and constructors.

If the injected class is an interface the interface may use the GreedyDefaultImplementation in order to specify the class that should be used when another implementation of this interface cannot be found.

Warning

This resolve should be used with care as it could cause unexpected class files to be instantiated by hk2

Author
jwells

Field Summary

Modifier and TypeField and Description
private final ServiceLocator

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
justInTimeResolution(Injectee failedInjectionPoint)

Implements org.glassfish.hk2.api.JustInTimeInjectionResolver.justInTimeResolution.

This method will be called whenever an injection point cannot be resolved.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

locatorback to summary
private final ServiceLocator locator

Constructor Detail

GreedyResolverback to summary
private GreedyResolver(ServiceLocator locator)
Annotations
@Inject

Method Detail

justInTimeResolutionback to summary
public boolean justInTimeResolution(Injectee failedInjectionPoint)

Implements org.glassfish.hk2.api.JustInTimeInjectionResolver.justInTimeResolution.

Doc from org.glassfish.hk2.api.JustInTimeInjectionResolver.justInTimeResolution.

This method will be called whenever an injection point cannot be resolved. If this method adds anything to the configuration it should return true. Otherwise it should return false. The injection point that failed to be resolved is given in failedInjectionPoint.

If this method throws an exception that exception will be added to the set of exceptions in the MultiException that may be thrown from the injection resolver.

This method can be called on multiple threads with different or the same Injectee. Therefore care must be taken in this method to not add the same descriptor more than once

Annotations
@Override