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 thesuggestion. 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 beTokenRange(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 Summary
ConstructorsConstructorDescriptionCompletionSuggestion(String suggestion, net.minecraft.network.chat.Component display, String suffix, TokenRange replacementRange) Creates an instance of aCompletionSuggestionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.network.chat.Componentdisplay()Returns the value of thedisplayrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Inserts the suggestion into the given string.Returns the value of thereplacementRangerecord component.suffix()Returns the value of thesuffixrecord component.Returns the value of thesuggestionrecord component.toInsert()Gets the string to insert, combining the suggestion and the suffix.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CompletionSuggestion
public CompletionSuggestion(String suggestion, net.minecraft.network.chat.Component display, String suffix, TokenRange replacementRange) Creates an instance of aCompletionSuggestionrecord class.- Parameters:
suggestion- the value for thesuggestionrecord componentdisplay- the value for thedisplayrecord componentsuffix- the value for thesuffixrecord componentreplacementRange- the value for thereplacementRangerecord component
-
-
Method Details
-
replaceIn
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
Gets the string to insert, combining the suggestion and the suffix.- Returns:
- The string to insert.
-
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). -
suggestion
Returns the value of thesuggestionrecord component.- Returns:
- the value of the
suggestionrecord component
-
display
public net.minecraft.network.chat.Component display()Returns the value of thedisplayrecord component.- Returns:
- the value of the
displayrecord component
-
suffix
Returns the value of thesuffixrecord component.- Returns:
- the value of the
suffixrecord component
-
replacementRange
Returns the value of thereplacementRangerecord component.- Returns:
- the value of the
replacementRangerecord component
-