kotlin.coroutines.Continuation Java Examples

The following examples show how to use kotlin.coroutines.Continuation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KotlinCoroutinesReturnTypeParser.java    From springdoc-openapi with Apache License 2.0 6 votes vote down vote up
@Override
public Type getReturnType(MethodParameter methodParameter) {
	Method method = methodParameter.getMethod();
	Type returnType = Object.class;
	Optional<Parameter> continuationParameter = Arrays.stream(method.getParameters())
			.filter(parameter -> parameter.getType().getCanonicalName().equals(Continuation.class.getCanonicalName()))
			.findFirst();
	if (continuationParameter.isPresent()) {
		Type continuationType = continuationParameter.get().getParameterizedType();
		if (continuationType instanceof ParameterizedType) {
			Type actualTypeArguments = ((ParameterizedType) continuationType).getActualTypeArguments()[0];
			if (actualTypeArguments instanceof WildcardType)
				returnType = ((WildcardType) actualTypeArguments).getLowerBounds()[0];
		}
	}
	return returnType;
}
 
Example #2
Source File: ReactiveAdapterKotlin.java    From alibaba-rsocket-broker with Apache License 2.0 4 votes vote down vote up
@Override
public Object fromPublisher(Mono<?> mono, Class<?> returnType, MutableContext mutableContext) {
    final Continuation<?> continuation = mutableContext.get(Continuation.class);
    mono.doOnSuccess(continuation::resumeWith).doOnError(continuation::resumeWith).subscribe();
    return IntrinsicsKt.getCOROUTINE_SUSPENDED();
}
 
Example #3
Source File: ControllerWithContinuationParameter.java    From springdoc-openapi with Apache License 2.0 4 votes vote down vote up
@Operation(summary = "Ignore Continuation parameter")
@GetMapping(value = "/test/{id}", produces = { MediaType.APPLICATION_JSON_VALUE })
public Mono<String> get(@PathVariable(value = "id") String key, Continuation continuation) {
	return null;
}
 
Example #4
Source File: GeolocationLocalizationProvider.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
@Nullable
@Override
public SearchLocalization determineRegion(@NonNull Continuation<? super SearchLocalization> continuation) {
    return new SearchLocalization(mLanguage, mCountry, mRegion);
}