Package com.vaadin.copilot
Record Class ComponentEventCollector
java.lang.Object
java.lang.Record
com.vaadin.copilot.ComponentEventCollector
- Record Components:
vaadinContext- Vaadin context used to detect Spring and resolve the application's base package.
public record ComponentEventCollector(com.vaadin.flow.server.VaadinContext vaadinContext)
extends Record
Collects component event listener methods (methods returning
Registration) from Vaadin Flow components found on the classpath, and
optionally maps selected events to React-style attribute names.
The scan includes com.vaadin.flow and the user's application base
package (when Spring is available).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDescribes an event listener method discovered on a component type.static final recordHolds the collected event listener information, grouped in two ways: By Java fully-qualified component class name. By VaadinTagname for components that have a mapped React attribute name. -
Constructor Summary
ConstructorsConstructorDescriptionComponentEventCollector(com.vaadin.flow.server.VaadinContext vaadinContext) Creates an instance of aComponentEventCollectorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Scans the classpath for Vaadin FlowComponentsubclasses and collects listener-style methods.final inthashCode()Returns a hash code value for this object.static StringresolveErasedTypeName(io.github.classgraph.TypeSignature type) Resolves an "erased" (raw) type name from aTypeSignature.final StringtoString()Returns a string representation of this record class.com.vaadin.flow.server.VaadinContextReturns the value of thevaadinContextrecord component.
-
Constructor Details
-
ComponentEventCollector
public ComponentEventCollector(com.vaadin.flow.server.VaadinContext vaadinContext) Creates an instance of aComponentEventCollectorrecord class.- Parameters:
vaadinContext- the value for thevaadinContextrecord component
-
-
Method Details
-
getResult
Scans the classpath for Vaadin FlowComponentsubclasses and collects listener-style methods.A method is considered a candidate event listener registration when:
- Its return type erases to
Registration. - It is not a "signal" registration method (parameters referencing
com.vaadin.signals). - It is not listed in
methodNamesToIgnore.
- Returns:
- the collected events grouped by component class and (when applicable)
by
Tagname
- Its return type erases to
-
resolveErasedTypeName
Resolves an "erased" (raw) type name from aTypeSignature.This is used to compare method return types against
Registrationwithout requiring generic resolution.- Parameters:
type- the type signature to resolve- Returns:
- the fully qualified class name for class references, an array type name for array signatures, or a simple-name representation for other signature kinds
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
vaadinContext
public com.vaadin.flow.server.VaadinContext vaadinContext()Returns the value of thevaadinContextrecord component.- Returns:
- the value of the
vaadinContextrecord component
-