Unverified Commit d321fe52 authored by Jérémie Bresson's avatar Jérémie Bresson Committed by GitHub
Browse files

Allow to use Integer for ids (#1087)

Fixes #1078
parent 7b07abd0
......@@ -43,6 +43,9 @@ public abstract class AbstractApi implements Constants {
throw (new RuntimeException("Cannot determine ID or path from null object"));
} else if (obj instanceof Long) {
return (obj);
} else if (obj instanceof Integer) {
//Compatibility with older version of gitlab4j-api:
return Long.valueOf(((Integer) obj).longValue());
} else if (obj instanceof String) {
return (urlEncode(((String) obj).trim()));
} else if (obj instanceof Project) {
......@@ -78,6 +81,9 @@ public abstract class AbstractApi implements Constants {
throw (new RuntimeException("Cannot determine ID or path from null object"));
} else if (obj instanceof Long) {
return (obj);
} else if (obj instanceof Integer) {
//Compatibility with older version of gitlab4j-api:
return Long.valueOf(((Integer) obj).longValue());
} else if (obj instanceof String) {
return (urlEncode(((String) obj).trim()));
} else if (obj instanceof Group) {
......@@ -113,6 +119,9 @@ public abstract class AbstractApi implements Constants {
throw (new RuntimeException("Cannot determine ID or username from null object"));
} else if (obj instanceof Long) {
return (obj);
} else if (obj instanceof Integer) {
//Compatibility with older version of gitlab4j-api:
return Long.valueOf(((Integer) obj).longValue());
} else if (obj instanceof String) {
return (urlEncode(((String) obj).trim()));
} else if (obj instanceof User) {
......@@ -148,6 +157,9 @@ public abstract class AbstractApi implements Constants {
throw (new RuntimeException("Cannot determine ID or name from null object"));
} else if (obj instanceof Long) {
return (obj);
} else if (obj instanceof Integer) {
//Compatibility with older version of gitlab4j-api:
return Long.valueOf(((Integer) obj).longValue());
} else if (obj instanceof String) {
return (urlEncode(((String) obj).trim()));
} else if (obj instanceof Label) {
......@@ -176,6 +188,9 @@ public abstract class AbstractApi implements Constants {
throw (new RuntimeException("Cannot determine ID or path from null object"));
} else if (obj instanceof Long) {
return (obj);
} else if (obj instanceof Integer) {
//Compatibility with older version of gitlab4j-api:
return Long.valueOf(((Integer) obj).longValue());
} else if (obj instanceof String) {
return (urlEncode(((String) obj).trim()));
} else if (obj instanceof Namespace) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment