Record Class MessageField
java.lang.Object
java.lang.Record
wtf.choco.veinminer.documentation.MessageField
- Record Components:
expectedType
- the expected type name (constants found in this class)name
- the name of the fielddescription
- the description of the field
Represents a field in a protocol message.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMessageField
(String expectedType, String name, String description) Creates an instance of aMessageField
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic final String
Generate an HTML table that represents a simple bitmask.Returns the value of thedescription
record component.final boolean
Indicates whether some other object is "equal to" this one.Returns the value of theexpectedType
record component.final int
hashCode()
Returns a hash code value for this object.name()
Returns the value of thename
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
TYPE_BOOLEAN
Boolean type.- See Also:
-
TYPE_BYTE
Byte type.- See Also:
-
TYPE_VARINT
VarInt type.- See Also:
-
TYPE_BLOCK_POSITION
BlockPosition type.- See Also:
-
TYPE_NAMESPACED_KEY
NamespacedKey type.- See Also:
-
TYPE_ARRAY_OF
AFunction
that creates a new type prefixed with "Array of".
-
-
Constructor Details
-
MessageField
Creates an instance of aMessageField
record class.- Parameters:
expectedType
- the value for theexpectedType
record componentname
- the value for thename
record componentdescription
- the value for thedescription
record component
-
-
Method Details
-
bitmask
Generate an HTML table that represents a simple bitmask.For instance, the following:
MessageField.bitmask( "The least significant bit description", "The second bit in the field", "The third bit in the field", "The final, most significant bit in the field );
will generate the table below:<table> <thead> <th>Byte</th> <th>Meaning</th> </thead> <tbody> <tr> <td>0x1</td> <td>The least significant bit description</td> </tr> <tr> <td>0x2</td> <td>The second bit in the field</td> </tr> <tr> <td>0x4</td> <td>The third bit in the field</td> </tr> <tr> <td>0x8</td> <td>The final, most significant bit in the field</td> </tr> </tbody> </table>
- Parameters:
descriptions
- the descriptions in order of least significant bit to most significant bit- Returns:
- the bitmask table
-
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)
. -
expectedType
Returns the value of theexpectedType
record component.- Returns:
- the value of the
expectedType
record component
-
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
description
Returns the value of thedescription
record component.- Returns:
- the value of the
description
record component
-