Package org.moddingx.libx.network
Record Class NetworkX.Protocol
java.lang.Object
java.lang.Record
org.moddingx.libx.network.NetworkX.Protocol
- Record Components:
version
- The protocol version. This must be equal on client and serverclient
- The behaviour for the clientserver
- The behaviour for the dedicated server
- Enclosing class:
- NetworkX
public static record NetworkX.Protocol(String version, NetworkX.ProtocolSide client, NetworkX.ProtocolSide server)
extends Record
A protocol defines when a connection is accepted or rejected.
-
Constructor Summary
ConstructorDescriptionProtocol
(String version, NetworkX.ProtocolSide client, NetworkX.ProtocolSide server) Creates an instance of aProtocol
record class. -
Method Summary
Modifier and TypeMethodDescriptionclient()
Returns the value of theclient
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.static NetworkX.Protocol
Creates a new protocol with the given version, that is required on both sides.server()
Returns the value of theserver
record component.final String
toString()
Returns a string representation of this record class.version()
Returns the value of theversion
record component.
-
Constructor Details
-
Method Details
-
of
Creates a new protocol with the given version, that is required on both sides. -
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)
. -
version
Returns the value of theversion
record component.- Returns:
- the value of the
version
record component
-
client
Returns the value of theclient
record component.- Returns:
- the value of the
client
record component
-
server
Returns the value of theserver
record component.- Returns:
- the value of the
server
record component
-