Skip to content

REST: support a @QueryParam that is a generic type that extends enum in an abstract class. #33816

Open
@ge0ffrey

Description

Description

Given:

@Path("demo")
public abstract class AbstractDemoResource<DataType_ extends Enum<DataType_>, Solution_> {
    ...

    @GET
    @Path("data")
    public abstract Solution_ generate(@QueryParam("type") DataType_ demoDataType);

}


public class TimeTableDemoResource extends AbstractDemoResource<TimeTableDemoResource.DemoDataType, TimeTable> {
    public enum DemoDataType {
        SMALL,
        LARGE
    }
   ...
}

Actual behavior:

RESTEASY003875: Unable to find a constructor that takes a String param or a valueOf() or fromString() method for jakarta.ws.rs.QueryParam("type") on public abstract java.lang.Object org.acme.schooltimetabling.service.AbstractDemoResource.generate(java.lang.Enum) for basetype: java.lang.Enum

Expected behavior:

Only resolve the query param type for the concrete class, which does know it's DemoDataType, not just Enum.

Implementation ideas

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions