final Paginated paginated = route.getTargetMethod().getAnnotation(Paginated.class);
final String customHeader = paginated.customHeadersPrefix();
return Pagination.offset(paginated.offsetParamName(), argAsString(args, paginated.offsetParamName()))
.limitParam(paginated.limitParamName(), argAsString(args, paginated.limitParamName()))
.customHeadersPrefix(customHeader)
.webLinking(paginated.webLinking())
.build();
}
private String argAsString(final Map<String, Object> args, final String argName) {
return (String) args.get(argName);