Class LiteralInput<T>
java.lang.Object
com.vaadin.flow.component.trigger.internal.Action.Input<T>
com.vaadin.flow.component.trigger.internal.LiteralInput<T>
- Type Parameters:
T- the runtime type of the value
- All Implemented Interfaces:
Serializable
Input backed by a server-side literal that is JSON-encoded into the JS at
build time. Lets actions take
Action.Input<? extends T> uniformly
while still accepting plain constants from callers — e.g. copying a fixed
string to the clipboard:
new ClickTrigger(button).triggers(
new CopyTextToClipboardAction(new LiteralInput<>("hello"), () -> {
}, err -> {
}));
The value is required to be non-null: null as a literal payload
almost never matches a sensible browser API call (e.g.
writeText(null) writes the string "null" to the clipboard).
Actions that need to emit a literal null should do so through their
own mechanism — see SetPropertyAction's null-clearing convenience
constructor.
For internal use only. May be renamed or removed in a future release.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendExpression(com.vaadin.flow.component.trigger.internal.JsBuilder builder, StringBuilder out) Appends this input's JS expression toout.
-
Constructor Details
-
LiteralInput
Creates a literal input wrapping the given value.- Parameters:
value- the value to encode, notnull
-
-
Method Details
-
appendExpression
protected void appendExpression(com.vaadin.flow.component.trigger.internal.JsBuilder builder, StringBuilder out) Description copied from class:Action.InputAppends this input's JS expression toout. Element references must go throughJsBuilder.reference(com.vaadin.flow.dom.Element).- Specified by:
appendExpressionin classAction.Input<T>- Parameters:
builder- collects element parameter references, notnullout- buffer to append into, notnull
-