Would this method (or one like it) work in the SerialPortEvent class?
@Override
public final String toString() {
return switch(eventType) {
case SerialPort.LISTENING_EVENT_DATA_AVAILABLE -> "LISTENING_EVENT_DATA_AVAILABLE";
case SerialPort.LISTENING_EVENT_DATA_RECEIVED -> "LISTENING_EVENT_DATA_RECEIVED";
case SerialPort.LISTENING_EVENT_DATA_WRITTEN -> "LISTENING_EVENT_DATA_WRITTEN";
case SerialPort.LISTENING_EVENT_PORT_DISCONNECTED -> "LISTENING_EVENT_PORT_DISCONNECTED";
case SerialPort.LISTENING_EVENT_BREAK_INTERRUPT -> "LISTENING_EVENT_BREAK_INTERRUPT";
case SerialPort.LISTENING_EVENT_CARRIER_DETECT -> "LISTENING_EVENT_CARRIER_DETECT";
case SerialPort.LISTENING_EVENT_CTS -> "LISTENING_EVENT_CTS";
case SerialPort.LISTENING_EVENT_DSR -> "LISTENING_EVENT_DSR";
case SerialPort.LISTENING_EVENT_RING_INDICATOR -> "LISTENING_EVENT_RING_INDICATOR";
case SerialPort.LISTENING_EVENT_FRAMING_ERROR -> "LISTENING_EVENT_FRAMING_ERROR";
case SerialPort.LISTENING_EVENT_FIRMWARE_OVERRUN_ERROR -> "LISTENING_EVENT_FIRMWARE_OVERRUN_ERROR";
case SerialPort.LISTENING_EVENT_SOFTWARE_OVERRUN_ERROR -> "LISTENING_EVENT_SOFTWARE_OVERRUN_ERROR";
case SerialPort.LISTENING_EVENT_PARITY_ERROR -> "LISTENING_EVENT_PARITY_ERROR";
}
}
Would this method (or one like it) work in the
SerialPortEvent
class?