Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methodInfoResolver attribute to Coroutinebuilder #1762

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion kotlin/src/main/java/feign/kotlin/CoroutineFeign.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import feign.BaseBuilder;
import feign.Client;
import feign.Experimental;
import feign.MethodInfoResolver;
import feign.Target;
import feign.Target.HardCodedTarget;
import java.lang.reflect.InvocationHandler;
Expand Down Expand Up @@ -116,6 +117,7 @@ public static class CoroutineBuilder<C> extends BaseBuilder<CoroutineBuilder<C>>
private AsyncContextSupplier<C> defaultContextSupplier = () -> null;
private AsyncClient<C> client = new AsyncClient.Default<>(
new Client.Default(null, null), LazyInitializedExecutorService.instance);
private MethodInfoResolver methodInfoResolver = KotlinMethodInfo::createInstance;

@Deprecated
public CoroutineBuilder<C> defaultContextSupplier(Supplier<C> supplier) {
Expand All @@ -133,6 +135,11 @@ public CoroutineBuilder<C> defaultContextSupplier(AsyncContextSupplier<C> suppli
return this;
}

public CoroutineBuilder<C> methodInfoResolver(MethodInfoResolver methodInfoResolver) {
this.methodInfoResolver = methodInfoResolver;
return this;
}

public <T> T target(Class<T> apiType, String url) {
return target(new HardCodedTarget<>(apiType, url));
}
Expand Down Expand Up @@ -167,7 +174,7 @@ public CoroutineFeign<C> build() {
.responseInterceptor(responseInterceptor)
.invocationHandlerFactory(invocationHandlerFactory)
.defaultContextSupplier((AsyncContextSupplier<Object>) defaultContextSupplier)
.methodInfoResolver(KotlinMethodInfo::createInstance)
.methodInfoResolver(methodInfoResolver)
.build();
return new CoroutineFeign<>(asyncFeign);
}
Expand Down