Consider two classes:
First
@Path("/first/{param}") // 1st line
public class First {
@GET
@Path("/{data}/difference") // 5th line
public Response doStuff(
@Context HttpServletRequest request,
@Context UriInfo uri,
@Context HttpHeaders httpHeaders,
@PathParam("param") String param,
@PathParam("data") String data
) {
// whatever
return new Response();
}
}
Second
@Path("/second/{param}") // 1st line
public class Second extends First {
@GET
@Path("/{data}") // 5th line
public Response doStuff(
@Context HttpServletRequest request,
@Context UriInfo uri,
@Context HttpHeaders httpHeaders,
@PathParam("param") String param,
@PathParam("data") String data
) {
return super.doStuff(
request,
uri,
httpHeaders,
param,
data
);
}
}
The only differences between this two block of code are:
@Path()annotation value in the 1st line of both of them@Path()annotation value in the 5th line of both of them
How can I remove all the redundant code from it?
return super.doStuffandextendsfor example. What problem are you trying to solve? \$\endgroup\$