use of org.glassfish.jersey.server.spi.internal.ParamValueFactoryWithSource in project jersey by jersey.
the class JavaResourceMethodDispatcherProvider method create.
@Override
public ResourceMethodDispatcher create(final Invocable resourceMethod, final InvocationHandler invocationHandler, final ConfiguredValidator validator) {
final List<ParamValueFactoryWithSource<?>> valueProviders = ParameterValueHelper.createValueProviders(injectionManager, resourceMethod);
final Class<?> returnType = resourceMethod.getHandlingMethod().getReturnType();
ResourceMethodDispatcher resourceMethodDispatcher = null;
if (Response.class.isAssignableFrom(returnType)) {
resourceMethodDispatcher = new ResponseOutInvoker(resourceMethod, invocationHandler, valueProviders, validator);
} else if (returnType != void.class) {
if (returnType == Object.class || GenericEntity.class.isAssignableFrom(returnType)) {
resourceMethodDispatcher = new ObjectOutInvoker(resourceMethod, invocationHandler, valueProviders, validator);
} else {
resourceMethodDispatcher = new TypeOutInvoker(resourceMethod, invocationHandler, valueProviders, validator);
}
} else {
// return type is void
int i = 0;
for (final Parameter parameter : resourceMethod.getParameters()) {
if (SseEventSink.class.equals(parameter.getRawType())) {
resourceMethodDispatcher = new SseEventSinkInvoker(resourceMethod, invocationHandler, valueProviders, validator, i);
break;
}
i++;
}
if (resourceMethodDispatcher == null) {
resourceMethodDispatcher = new VoidOutInvoker(resourceMethod, invocationHandler, valueProviders, validator);
}
}
// Inject validator.
injectionManager.inject(resourceMethodDispatcher);
return resourceMethodDispatcher;
}
Aggregations