java.lang.Object
java.lang.Record
pl.polsl.rtsa.api.dto.AvailablePorts
- Record Components:
ports- List of available port names.lastRefreshTime- Unix timestamp of last refresh.
Data Transfer Object for available serial ports.
Immutable record for thread-safe access.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longThe field for thelastRefreshTimerecord component.The field for theportsrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionAvailablePorts(List<String> ports, long lastRefreshTime) Creates an instance of aAvailablePortsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcount()Returns the number of available ports.static AvailablePortsempty()Creates an empty ports list with timestamp = 0 to force refresh on first use.final booleanIndicates whether some other object is "equal to" this one.booleanChecks if any ports are available.final inthashCode()Returns a hash code value for this object.longReturns the value of thelastRefreshTimerecord component.ports()Returns the value of theportsrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
ports
The field for theportsrecord component. -
lastRefreshTime
private final long lastRefreshTimeThe field for thelastRefreshTimerecord component.
-
-
Constructor Details
-
AvailablePorts
Creates an instance of aAvailablePortsrecord class.- Parameters:
ports- the value for theportsrecord componentlastRefreshTime- the value for thelastRefreshTimerecord component
-
-
Method Details
-
empty
Creates an empty ports list with timestamp = 0 to force refresh on first use. -
hasAvailablePorts
public boolean hasAvailablePorts()Checks if any ports are available. -
count
public int count()Returns the number of available ports. -
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 '=='. -
ports
Returns the value of theportsrecord component.- Returns:
- the value of the
portsrecord component
-
lastRefreshTime
public long lastRefreshTime()Returns the value of thelastRefreshTimerecord component.- Returns:
- the value of the
lastRefreshTimerecord component
-