Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 50f43cc

Browse filesBrowse files
committed
Inserted backward compatibility methods
1 parent f421067 commit 50f43cc
Copy full SHA for 50f43cc

File tree

Expand file treeCollapse file tree

1 file changed

+20
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+20
-6
lines changed

‎src/main/java/org/kohsuke/github/GHObject.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHObject.java
+20-6Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package org.kohsuke.github;
22

3+
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
4+
5+
import java.io.IOException;
36
import java.net.URL;
47
import java.util.Date;
58

@@ -18,32 +21,43 @@ public abstract class GHObject {
1821
/**
1922
* When was this resource created?
2023
*/
21-
public Date getCreatedAt() {
24+
@WithBridgeMethods(value=String.class, adapterMethod="createdAtStr")
25+
public Date getCreatedAt() throws IOException {
2226
return GitHub.parseDate(created_at);
2327
}
2428

29+
private Object createdAtStr(Date id, Class type) {
30+
return created_at;
31+
}
32+
2533
/**
2634
* API URL of this object.
27-
*
28-
* TODO: need to also return String
2935
*/
36+
@WithBridgeMethods(value=String.class, adapterMethod="urlToString")
3037
public URL getUrl() {
3138
return GitHub.parseURL(url);
3239
}
3340

3441
/**
3542
* When was this resource last updated?
3643
*/
37-
public Date getUpdatedAt() {
44+
public Date getUpdatedAt() throws IOException {
3845
return GitHub.parseDate(updated_at);
3946
}
4047

4148
/**
4249
* Unique ID number of this resource.
43-
*
44-
* TODO: need to also return String
4550
*/
51+
@WithBridgeMethods(value=String.class, adapterMethod="intToString")
4652
public int getId() {
4753
return id;
4854
}
55+
56+
private Object intToString(int id, Class type) {
57+
return String.valueOf(id);
58+
}
59+
60+
private Object urlToString(URL url, Class type) {
61+
return url==null ? null : url.toString();
62+
}
4963
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.