Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit c5cf0a8

Browse files
committed
Migrate http methods to kotlin
1 parent aebd728 commit c5cf0a8

File tree

4 files changed

+45
-68
lines changed

4 files changed

+45
-68
lines changed
Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,22 @@
2121
* THE SOFTWARE.
2222
*
2323
*/
24+
package com.owncloud.android.lib.common.http.methods.nonwebdav
2425

25-
package com.owncloud.android.lib.common.http.methods.nonwebdav;
26-
27-
import java.io.IOException;
28-
import java.net.URL;
26+
import java.io.IOException
27+
import java.net.URL
2928

3029
/**
3130
* OkHttp delete calls wrapper
3231
*
3332
* @author David González Verdugo
3433
*/
35-
public class DeleteMethod extends HttpMethod {
36-
37-
public DeleteMethod(URL url) {
38-
super(url);
39-
}
40-
41-
@Override
42-
public int onExecute() throws IOException {
34+
class DeleteMethod(url: URL?) : HttpMethod(url) {
35+
@Throws(IOException::class)
36+
override fun onExecute(): Int {
4337
mRequest = mRequest.newBuilder()
44-
.delete()
45-
.build();
46-
47-
return super.onExecute();
38+
.delete()
39+
.build()
40+
return super.onExecute()
4841
}
49-
}
42+
}
Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,22 @@
2121
* THE SOFTWARE.
2222
*
2323
*/
24+
package com.owncloud.android.lib.common.http.methods.nonwebdav
2425

25-
package com.owncloud.android.lib.common.http.methods.nonwebdav;
26-
27-
import java.io.IOException;
28-
import java.net.URL;
26+
import java.io.IOException
27+
import java.net.URL
2928

3029
/**
3130
* OkHttp get calls wrapper
3231
*
3332
* @author David González Verdugo
3433
*/
35-
public class GetMethod extends HttpMethod {
36-
37-
public GetMethod(URL url) {
38-
super(url);
39-
}
40-
41-
@Override
42-
public int onExecute() throws IOException {
34+
class GetMethod(url: URL?) : HttpMethod(url) {
35+
@Throws(IOException::class)
36+
override fun onExecute(): Int {
4337
mRequest = mRequest.newBuilder()
44-
.get()
45-
.build();
46-
47-
return super.onExecute();
38+
.get()
39+
.build()
40+
return super.onExecute()
4841
}
49-
}
42+
}
Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,22 @@
2121
* THE SOFTWARE.
2222
*
2323
*/
24+
package com.owncloud.android.lib.common.http.methods.nonwebdav
2425

25-
package com.owncloud.android.lib.common.http.methods.nonwebdav;
26-
27-
import java.io.IOException;
28-
import java.net.URL;
26+
import java.io.IOException
27+
import java.net.URL
2928

3029
/**
3130
* OkHttp post calls wrapper
3231
*
3332
* @author David González Verdugo
3433
*/
35-
public class PostMethod extends HttpMethod {
36-
37-
public PostMethod(URL url) {
38-
super(url);
39-
}
40-
41-
@Override
42-
public int onExecute() throws IOException {
34+
class PostMethod(url: URL?) : HttpMethod(url) {
35+
@Throws(IOException::class)
36+
override fun onExecute(): Int {
4337
mRequest = mRequest.newBuilder()
44-
.post(mRequestBody)
45-
.build();
46-
47-
return super.onExecute();
38+
.post(mRequestBody)
39+
.build()
40+
return super.onExecute()
4841
}
49-
}
42+
}
Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,22 @@
2121
* THE SOFTWARE.
2222
*
2323
*/
24+
package com.owncloud.android.lib.common.http.methods.nonwebdav
2425

25-
package com.owncloud.android.lib.common.http.methods.nonwebdav;
26+
import java.io.IOException
27+
import java.net.URL
2628

27-
import java.io.IOException;
28-
import java.net.URL;
29-
30-
public class PutMethod extends HttpMethod {
31-
32-
public PutMethod(URL url) {
33-
super(url);
34-
}
35-
36-
@Override
37-
public int onExecute() throws IOException {
29+
/**
30+
* OkHttp put calls wrapper
31+
*
32+
* @author David González Verdugo
33+
*/
34+
class PutMethod(url: URL?) : HttpMethod(url) {
35+
@Throws(IOException::class)
36+
override fun onExecute(): Int {
3837
mRequest = mRequest.newBuilder()
39-
.put(mRequestBody)
40-
.build();
41-
42-
return super.onExecute();
38+
.put(mRequestBody)
39+
.build()
40+
return super.onExecute()
4341
}
44-
}
42+
}

0 commit comments

Comments
 (0)