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
f94a51d7
Commit
f94a51d7
authored
Dec 16, 2018
by
Greg Messner
Browse files
Changed the way sources of arrays are unmarshalled.
parent
adaccdc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/utils/JacksonJson.java
View file @
f94a51d7
...
...
@@ -12,6 +12,7 @@ import java.util.Map;
import
java.util.TimeZone
;
import
javax.ws.rs.Produces
;
import
javax.ws.rs.core.GenericType
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.ext.ContextResolver
;
import
javax.ws.rs.ext.Provider
;
...
...
@@ -37,6 +38,7 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.databind.SerializerProvider
;
import
com.fasterxml.jackson.databind.module.SimpleModule
;
import
com.fasterxml.jackson.databind.type.CollectionType
;
import
com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider
;
/**
...
...
@@ -132,7 +134,8 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol
*/
public
<
T
>
List
<
T
>
unmarshalList
(
Class
<
T
>
returnType
,
Reader
reader
)
throws
JsonParseException
,
JsonMappingException
,
IOException
{
ObjectMapper
objectMapper
=
getContext
(
null
);
return
(
objectMapper
.
readValue
(
reader
,
new
TypeReference
<
List
<
T
>>()
{}));
CollectionType
javaType
=
objectMapper
.
getTypeFactory
().
constructCollectionType
(
List
.
class
,
returnType
);
return
(
objectMapper
.
readValue
(
reader
,
javaType
));
}
/**
...
...
@@ -148,7 +151,8 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol
*/
public
<
T
>
List
<
T
>
unmarshalList
(
Class
<
T
>
returnType
,
String
postData
)
throws
JsonParseException
,
JsonMappingException
,
IOException
{
ObjectMapper
objectMapper
=
getContext
(
null
);
return
objectMapper
.
readValue
(
postData
,
new
TypeReference
<
List
<
T
>>()
{});
CollectionType
javaType
=
objectMapper
.
getTypeFactory
().
constructCollectionType
(
List
.
class
,
returnType
);
return
(
objectMapper
.
readValue
(
postData
,
javaType
));
}
/**
...
...
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