Record Class ElementListenerMap.SnippetEntry
java.lang.Object
java.lang.Record
com.vaadin.flow.internal.nodefeature.ElementListenerMap.SnippetEntry
- Record Components:
key- the key that the client sends the value under, notnullcall- the call that the client runs, notnullsideEffect- the name of the method of the event that the client calls when the call returns a truthy value, ornullif there is no side effectfilter-trueif the entry is the filter of a listener, which is notified only when the value is truthy, even if the same call is also event data;falseif it is only event data or has a side effectmapElement-trueif the call returns a DOM node that the client sends as the id of the closest state node, for event data of anElement;falseotherwise
- All Implemented Interfaces:
Serializable
- Enclosing class:
ElementListenerMap
public static record ElementListenerMap.SnippetEntry(String key, JsCall call, @Nullable String sideEffect, boolean filter, boolean mapElement)
extends Record
A function declared in the bundle, with the values it captures, that the
client runs when an event occurs: a filter added with
DomListenerRegistration.setFilterExpression(DomEventFilter) or
event data added with
DomListenerRegistration.addEventData(DomEventData). The client
runs the call and sends the value it returns to the server under the key
of the entry.
The key is @ followed by the key of the snippet, see
JsCall.createSnippetKey().
An entry can have a side effect: the name of a method of the event,
preventDefault or stopPropagation. The client
then calls the method when the call returns a truthy value. This is used
for addEventData("event.preventDefault()") on a listener
with a declared filter: the event is prevented only when the filter
passes. The key then ends with . and the name of the method,
so it is different from the key of the filter itself. Such an entry is
not a filter, as it doesn't decide which listeners are notified.
For internal use only. May be renamed or removed in a future release.
- Since:
- 25.4
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSnippetEntry(String key, JsCall call, @Nullable String sideEffect, boolean filter, boolean mapElement) Creates an instance of aSnippetEntryrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncall()Returns the value of thecallrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanfilter()Returns the value of thefilterrecord component.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.booleanReturns the value of themapElementrecord component.@Nullable StringReturns the value of thesideEffectrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SnippetEntry
public SnippetEntry(String key, JsCall call, @Nullable String sideEffect, boolean filter, boolean mapElement) Creates an instance of aSnippetEntryrecord class.- Parameters:
key- the value for thekeyrecord componentcall- the value for thecallrecord componentsideEffect- the value for thesideEffectrecord componentfilter- the value for thefilterrecord componentmapElement- the value for themapElementrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
call
Returns the value of thecallrecord component.- Returns:
- the value of the
callrecord component
-
sideEffect
Returns the value of thesideEffectrecord component.- Returns:
- the value of the
sideEffectrecord component
-
filter
public boolean filter()Returns the value of thefilterrecord component.- Returns:
- the value of the
filterrecord component
-
mapElement
public boolean mapElement()Returns the value of themapElementrecord component.- Returns:
- the value of the
mapElementrecord component
-