Skip to content

Commit 42447b4

Browse files
fix(APIClient): return APIClient instance in setUserAgent method
use this to improve code by method chaining
1 parent f2ec21b commit 42447b4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/net/hexonet/apiconnector/APIClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,16 @@ public String getURL() {
137137
*
138138
* @param str user agent label
139139
* @param rv user agent revision
140+
* @return Current APIClient instance for method chaining
140141
*/
141-
public void setUserAgent(String str, String rv) {
142+
public APIClient setUserAgent(String str, String rv) {
142143
String jv = System.getProperty("java.vm.name").toLowerCase().replaceAll(" .+", "");
143144
String jrv = System.getProperty("java.version");
144145
String arch = System.getProperty("os.arch");
145146
String os = System.getProperty("os.name");
146147
this.ua = (str + " (" + os + "; " + arch + "; rv:" + rv + ") java-sdk/" + this.getVersion()
147148
+ " " + jv + "/" + jrv);
149+
return this;
148150
}
149151

150152
/**

0 commit comments

Comments
 (0)