Package io.micronaut.views
Class DefaultModelAndViewRenderer<T>
java.lang.Object
io.micronaut.views.DefaultModelAndViewRenderer<T>
- Type Parameters:
T
- The model type
- All Implemented Interfaces:
ModelAndViewRenderer<T,
io.micronaut.http.HttpRequest<?>>
@Requires(classes=io.micronaut.http.HttpRequest.class)
@Singleton
@Internal
public class DefaultModelAndViewRenderer<T>
extends Object
implements ModelAndViewRenderer<T,io.micronaut.http.HttpRequest<?>>
Default implementation of
ModelAndViewRenderer
.
Given a ModelAndView
it will find the view by name, and render it with the model.
- Since:
- 5.2.0
- Author:
- Tim Yates
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultModelAndViewRenderer
(ViewsRendererLocator viewsRendererLocator, ViewsModelDecorator viewsModelDecorator) -
Method Summary
Modifier and TypeMethodDescription@NonNull Optional<io.micronaut.core.io.Writable>
render
(ModelAndView<T> modelAndView, io.micronaut.http.HttpRequest<?> request, String mediaType) Renders aModelAndView
into aWritable
.
-
Field Details
-
viewsRendererLocator
-
-
Constructor Details
-
DefaultModelAndViewRenderer
public DefaultModelAndViewRenderer(ViewsRendererLocator viewsRendererLocator, ViewsModelDecorator viewsModelDecorator)
-
-
Method Details
-
render
@NonNull public @NonNull Optional<io.micronaut.core.io.Writable> render(ModelAndView<T> modelAndView, io.micronaut.http.HttpRequest<?> request, String mediaType) Description copied from interface:ModelAndViewRenderer
Renders aModelAndView
into aWritable
.- Specified by:
render
in interfaceModelAndViewRenderer<T,
io.micronaut.http.HttpRequest<?>> - Parameters:
modelAndView
- Model And Viewrequest
- RequestmediaType
- Media Type- Returns:
- a
ModelAndView
into aWritable
-