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 field
description - the description of the field

public record MessageField(String expectedType, String name, String description) extends Record
Represents a field in a protocol message.
  • Field Details

  • Constructor Details

    • MessageField

      public MessageField(String expectedType, String name, String description)
      Creates an instance of a MessageField record class.
      Parameters:
      expectedType - the value for the expectedType record component
      name - the value for the name record component
      description - the value for the description record component
  • Method Details

    • bitmask

      public static final String bitmask(String... descriptions)
      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • expectedType

      public String expectedType()
      Returns the value of the expectedType record component.
      Returns:
      the value of the expectedType record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component