Package gui.page

Record Class PageEventHandler.HandlerMethod<T extends javafx.event.Event>

java.lang.Object
java.lang.Record
gui.page.PageEventHandler.HandlerMethod<T>
Enclosing interface:
PageEventHandler

public static record PageEventHandler.HandlerMethod<T extends javafx.event.Event>(javafx.event.EventType<T extends javafx.event.Event> eventType, javafx.event.EventHandler<? super T extends javafx.event.Event> eventHandler) extends Record
Combination of an EventType and an EventHandler which handles events of an appropriate type.

The type for this class looks intimidating, but its usage is fairly straightforward. Its purpose is simply to couple an EventType with an EventHandler so that they can easily be passed around together.

In the following example, a HandlerMethod is created which will accept all types of events and print them:

 new HandlerMethod(Event.ANY, e -> System.out.println(e));
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    HandlerMethod(javafx.event.EventType<T> eventType, javafx.event.EventHandler<? super T> eventHandler)
    Creates an instance of a HandlerMethod record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    javafx.event.EventHandler<? super T>
    Returns the value of the eventHandler record component.
    javafx.event.EventType<T>
    Returns the value of the eventType record component.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • HandlerMethod

      public HandlerMethod(javafx.event.EventType<T> eventType, javafx.event.EventHandler<? super T> eventHandler)
      Creates an instance of a HandlerMethod record class.
      Parameters:
      eventType - the value for the eventType record component
      eventHandler - the value for the eventHandler record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • eventType

      public javafx.event.EventType<T> eventType()
      Returns the value of the eventType record component.
      Returns:
      the value of the eventType record component
    • eventHandler

      public javafx.event.EventHandler<? super T> eventHandler()
      Returns the value of the eventHandler record component.
      Returns:
      the value of the eventHandler record component