java.lang.Object
java.lang.Record
pl.polsl.rtsa.api.dto.ConnectionStatus
- Record Components:
connected- Whether a device is currently connected.portName- The name of the connected port, or null if not connected.deviceInfo- Device identification string from handshake, or null.
public record ConnectionStatus(boolean connected, String portName, String deviceInfo)
extends Record
Data Transfer Object representing the connection state.
Immutable record for thread-safe access.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanThe field for theconnectedrecord component.private final StringThe field for thedeviceInforecord component.private final StringThe field for theportNamerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionConnectionStatus(boolean connected, String portName, String deviceInfo) Creates an instance of aConnectionStatusrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theconnectedrecord component.static ConnectionStatusCreates a connected status.Returns the value of thedeviceInforecord component.static ConnectionStatusCreates a disconnected status.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.portName()Returns the value of theportNamerecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
connected
private final boolean connectedThe field for theconnectedrecord component. -
portName
The field for theportNamerecord component. -
deviceInfo
The field for thedeviceInforecord component.
-
-
Constructor Details
-
ConnectionStatus
Creates an instance of aConnectionStatusrecord class.- Parameters:
connected- the value for theconnectedrecord componentportName- the value for theportNamerecord componentdeviceInfo- the value for thedeviceInforecord component
-
-
Method Details
-
disconnected
Creates a disconnected status. -
connected
Creates a connected status.- Parameters:
portName- The connected port name.deviceInfo- Device identification info.
-
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 '=='. -
connected
public boolean connected()Returns the value of theconnectedrecord component.- Returns:
- the value of the
connectedrecord component
-
portName
Returns the value of theportNamerecord component.- Returns:
- the value of the
portNamerecord component
-
deviceInfo
Returns the value of thedeviceInforecord component.- Returns:
- the value of the
deviceInforecord component
-