Skip to content

Commit 0f39d37

Browse files
dustismofernandezpablo85
authored andcommitted
add api() method to service builder
1 parent da3a3f4 commit 0f39d37

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

changelog.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@
2323

2424
* FEATURE: OAuth 2.0 Support and Facebook support out of the box (thanks Diego Silveira)
2525
* REFACTOR: Api creation and OAuthService refactors
26-
* REFACTOR: Connections are created lazily (just before sending the request)
26+
* REFACTOR: Connections are created lazily (just before sending the request)
27+
28+
[1.1.1]
29+
30+
* FIX: Removed isEmpty() from OAuth2.0 code in order to support older JVMs
31+
* FEATURE: Overloaded provider() method to support instances as well as classes (thanks dustismo)

src/main/java/org/scribe/builder/ServiceBuilder.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,22 @@ private Api createApi(Class<? extends Api> apiClass)
5555
}
5656
return api;
5757
}
58-
58+
59+
/**
60+
* Configures the {@link Api}
61+
*
62+
* Overloaded version. Let's you use an instance instead of a class.
63+
*
64+
* @param api instance of {@link Api}s
65+
* @return the {@link ServiceBuilder} instance for method chaining
66+
*/
67+
public ServiceBuilder provider(Api api)
68+
{
69+
Preconditions.checkNotNull(api, "Api cannot be null");
70+
this.api = api;
71+
return this;
72+
}
73+
5974
/**
6075
* Adds an OAuth callback url
6176
*

0 commit comments

Comments
 (0)