Search in sources :

Example 1 with ForeignDescriptorImpl

use of org.glassfish.jersey.internal.inject.ForeignDescriptorImpl in project jersey by jersey.

the class InjectionResolverWrapper method resolve.

@Override
public Object resolve(Injectee injectee, ServiceHandle root) {
    InjecteeImpl injecteeWrapper = new InjecteeImpl();
    injecteeWrapper.setRequiredType(injectee.getRequiredType());
    injecteeWrapper.setParent(injectee.getParent());
    injecteeWrapper.setRequiredQualifiers(injectee.getRequiredQualifiers());
    injecteeWrapper.setOptional(injectee.isOptional());
    injecteeWrapper.setPosition(injectee.getPosition());
    injecteeWrapper.setFactory(ReflectionHelper.isSubClassOf(injectee.getRequiredType(), Factory.class));
    injecteeWrapper.setInjecteeDescriptor(new ForeignDescriptorImpl(injectee.getInjecteeDescriptor()));
    Object instance = jerseyResolver.resolve(injecteeWrapper);
    if (injecteeWrapper.isFactory()) {
        return asFactory(instance);
    } else {
        return instance;
    }
}
Also used : InjecteeImpl(org.glassfish.jersey.internal.inject.InjecteeImpl) Factory(org.glassfish.hk2.api.Factory) ForeignDescriptorImpl(org.glassfish.jersey.internal.inject.ForeignDescriptorImpl)

Aggregations

Factory (org.glassfish.hk2.api.Factory)1 ForeignDescriptorImpl (org.glassfish.jersey.internal.inject.ForeignDescriptorImpl)1 InjecteeImpl (org.glassfish.jersey.internal.inject.InjecteeImpl)1