Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[yasson-dev] Custom Deserializer with Generics


Hi all,

I ‘m using wildfly 14 with jersey 2.27 and java 11.

 

Previously I used Jackson and now I’m trying to substitute it with yasson.

I’m using the yasson version provided by wildfly:

 

<dependency>

                    <groupId>org.eclipse</groupId>

                    <artifactId>yasson</artifactId>

                    <version>1.0.1</version>

                    <scope>provided</scope>

             </dependency>

 

I have the following deserializer:

public class GenericDeserializer implements JsonbDeserializer<Generic<?>> {

declared on Generic class

@JsonbTypeDeserializer(GenericDeserializer.class)

public class Generic<O extends Serializable> {


and a rest service that for example use the Generic class in this way:

 

@POST

@Path("/items/mass/{appName}/{id}")

@Consumes(MediaType.APPLICATION_JSON)

@Produces(MediaType.APPLICATION_JSON)

public Response mass(@PathParam("appName") String applicationName, @PathParam("id") Long id, Generic<BaseFilterDto>searchRequest)

 

of course the class BaseFilterDto is an example, but I can pass each type I want, so I cannot know which it is at deserializer creation time.

 

I tested the service but the deserializer is not called.

 

Is there a way to resolve this?

 

Thank you

Regards

 

Mara Notarnicola

 




Back to the top