Record Class CompletionSuggestion

java.lang.Object
java.lang.Record
com.blamejared.searchables.api.autcomplete.CompletionSuggestion
Record Components:
suggestion - The suggestion to insert.
display - The component to display to the user.
suffix - The text to insert of the suggestion. Generally either ":" or " "
replacementRange - The range of the current String to replace with this suggestion. Given the string "sha" and suggestion of "shape", the range will be TokenRange(0, 5)

public record CompletionSuggestion(String suggestion, net.minecraft.network.chat.Component display, String suffix, TokenRange replacementRange) extends Record
Represents a suggestion to be shown in AutoComplete
  • Constructor Details

    • CompletionSuggestion

      public CompletionSuggestion(String suggestion, net.minecraft.network.chat.Component display, String suffix, TokenRange replacementRange)
      Creates an instance of a CompletionSuggestion record class.
      Parameters:
      suggestion - the value for the suggestion record component
      display - the value for the display record component
      suffix - the value for the suffix record component
      replacementRange - the value for the replacementRange record component
  • Method Details

    • replaceIn

      public String replaceIn(String into)
      Inserts the suggestion into the given string.
      Parameters:
      into - The string to insert into.
      Returns:
      The given string with this suggestion inserted into it.
    • toInsert

      public String toInsert()
      Gets the string to insert, combining the suggestion and the suffix.
      Returns:
      The string to insert.
    • 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.
    • suggestion

      public String suggestion()
      Returns the value of the suggestion record component.
      Returns:
      the value of the suggestion record component
    • display

      public net.minecraft.network.chat.Component display()
      Returns the value of the display record component.
      Returns:
      the value of the display record component
    • suffix

      public String suffix()
      Returns the value of the suffix record component.
      Returns:
      the value of the suffix record component
    • replacementRange

      public TokenRange replacementRange()
      Returns the value of the replacementRange record component.
      Returns:
      the value of the replacementRange record component