public static TemplateViewRouteImpl create(String path,
                                               String acceptType,
                                               TemplateViewRoute route,
                                               TemplateEngine engine) {

        return new TemplateViewRouteImpl(path, acceptType, route) {
            @Override
            public String render(ModelAndView modelAndView) {
                return engine.render(modelAndView);
            }

            @Override
            public Object handle(Request request, Response response) throws Exception {
                return route.handle(request, response);
            }
        };
    }
factory method

@param path       the path
@param acceptType the accept type
@param route      the route
@param engine     the engine
@return the wrapper template view route
src/main/java/spark/TemplateViewRouteImpl.java