Package io.micronaut.views.pebble
Class PebbleViewsRenderer<T,R>
java.lang.Object
io.micronaut.views.pebble.PebbleViewsRenderer<T,R>
- Type Parameters:
T
- The model typeR
- The request type
- All Implemented Interfaces:
io.micronaut.core.order.Ordered
,ViewsRenderer<T,
R>
@Singleton
@Requires(property="micronaut.views.pebble.enabled",notEquals="false") @Requires(classes=io.pebbletemplates.pebble.PebbleEngine.class)
public class PebbleViewsRenderer<T,R>
extends Object
implements ViewsRenderer<T,R>
Renders Views with Pebble.
- Since:
- 2.2.0
- Author:
- Ecmel Ercan
- See Also:
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionPebbleViewsRenderer
(io.pebbletemplates.pebble.PebbleEngine engine, io.micronaut.core.util.LocaleResolver<R> httpLocaleResolver) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Constructor Details
-
PebbleViewsRenderer
public PebbleViewsRenderer(io.pebbletemplates.pebble.PebbleEngine engine, io.micronaut.core.util.LocaleResolver<R> httpLocaleResolver) - Parameters:
engine
- Pebble EnginehttpLocaleResolver
- The locale resolver
-
-
Method Details
-
render
@NonNull public @NonNull io.micronaut.core.io.Writable render(@NonNull @NonNull String name, @Nullable T data, @Nullable R request) - Specified by:
render
in interfaceViewsRenderer<T,
R> - Parameters:
name
- view name to be rendereddata
- response body to render it with a viewrequest
- HTTP request- Returns:
- A writable where the view will be written to.
-
exists
- Specified by:
exists
in interfaceViewsRenderer<T,
R> - Parameters:
name
- view name to be rendered- Returns:
- true if a template can be found for the supplied view name.
-