Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
d321fe52
Unverified
Commit
d321fe52
authored
Feb 06, 2024
by
Jérémie Bresson
Committed by
GitHub
Feb 06, 2024
Browse files
Allow to use Integer for ids (#1087)
Fixes #1078
parent
7b07abd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/AbstractApi.java
View file @
d321fe52
...
...
@@ -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
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment