Package io.micronaut.views.turbo
Class TurboStream.Builder
java.lang.Object
io.micronaut.views.turbo.TurboStream.Builder
- Enclosing class:
- TurboStream
Turbo Stream Builder.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaction
(TurboStreamAction action) after()
Sets the Turbo action asTurboStreamAction.AFTER
.append()
Sets the Turbo action asTurboStreamAction.APPEND
.before()
Sets the Turbo action asTurboStreamAction.BEFORE
.build()
static Optional<TurboStream.Builder>
of
(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.HttpResponse<?> response) Creates a Turbo Stream builder if annotationTurboView
is found in the route and the request is a turbo request.prepend()
Sets the Turbo action asTurboStreamAction.PREPEND
.remove()
Sets the Turbo action asTurboStreamAction.REMOVE
.replace()
Sets the Turbo action asTurboStreamAction.REPLACE
.targetCssQuerySelector
(String targetCssQuerySelector) targetCssQuerySelectorPattern
(Pattern pattern) targetDomId
(String targetDomId) targetDomIdPattern
(Pattern pattern) template
(io.micronaut.core.io.Writable writable) Sets the Turbo template with aWritable
.Sets the Turbo template with a String.Sets the template with a View and Model.templateModel
(Object templateModel) Sets the template's model.templateView
(String templateView) Sets the template's view name.update()
Sets the Turbo action asTurboStreamAction.UPDATE
.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
targetCssQuerySelectorPattern
- Parameters:
pattern
- HTML attributes validation Pattern- Returns:
- The Builder
-
targetDomIdPattern
- Parameters:
pattern
- HTML attributes validation Pattern- Returns:
- The Builder
-
action
- Parameters:
action
- Sets the Turbo Stream Action- Returns:
- The Builder
-
targetDomId
- Parameters:
targetDomId
- Target DOM ID- Returns:
- The Builder
-
targetCssQuerySelector
- Parameters:
targetCssQuerySelector
- Target CSS Query Selector- Returns:
- The Builder
-
template
Sets the template with a View and Model.- Parameters:
view
- The View namemodel
- The Model- Returns:
- The Builder
-
templateView
Sets the template's view name.- Parameters:
templateView
- The View name- Returns:
- The Builder
-
templateModel
Sets the template's model.- Parameters:
templateModel
- template model.- Returns:
- The Builder
-
template
Sets the Turbo template with a String. E.g. HTML.- Parameters:
html
- The turbo template- Returns:
- The Builder
-
template
Sets the Turbo template with aWritable
.- Parameters:
writable
- The template as aWritable
.- Returns:
- The Builder
-
append
Sets the Turbo action asTurboStreamAction.APPEND
.- Returns:
- The Builder.
-
prepend
Sets the Turbo action asTurboStreamAction.PREPEND
.- Returns:
- The Builder
-
update
Sets the Turbo action asTurboStreamAction.UPDATE
.- Returns:
- The Builder
-
remove
Sets the Turbo action asTurboStreamAction.REMOVE
.- Returns:
- The Builder.
-
after
Sets the Turbo action asTurboStreamAction.AFTER
.- Returns:
- The Builder.
-
before
Sets the Turbo action asTurboStreamAction.BEFORE
.- Returns:
- the Builder
-
replace
Sets the Turbo action asTurboStreamAction.REPLACE
.- Returns:
- the Builder
-
build
- Returns:
- Builds the
TurboStream
.
-
getTemplateView
- Returns:
- The TurboStream template view name.
-
getTemplateModel
- Returns:
- The TurboStream template model.
-
getTargetDomId
- Returns:
- TurboFrame Target DOM ID.
-
getTargetCssQuerySelector
- Returns:
- TurboFrame Target DOM ID.
-
of
@NonNull public static Optional<TurboStream.Builder> of(@NonNull io.micronaut.http.HttpRequest<?> request, @NonNull io.micronaut.http.HttpResponse<?> response) Creates a Turbo Stream builder if annotationTurboView
is found in the route and the request is a turbo request.- Parameters:
request
- HTTP Requestresponse
- HTTP Response- Returns:
- Creates a Turbo Stream builder if annotation
TurboView
is found in the route and the request is a turbo request.
-