Add documentation to Argument methods

This commit is contained in:
LeoDog896 2021-05-13 08:15:02 -04:00
parent 6a712b33a0
commit d50b5ac179

View File

@ -195,23 +195,48 @@ public abstract class Argument<T> {
return this; return this;
} }
/**
* Sets the default value supplier of the argument.
*
* @param defaultValue the default argument value
* @return 'this' for chaining
*/
@NotNull @NotNull
public Argument<T> setDefaultValue(@Nullable T defaultValue) { public Argument<T> setDefaultValue(@NotNull T defaultValue) {
this.defaultValue = () -> defaultValue; this.defaultValue = () -> defaultValue;
return this; return this;
} }
/**
* Gets the suggestion callback of the argument
*
* @see #setSuggestionCallback
* @return the suggestion callback of the argument, null if it doesn't exist
*/
@Nullable @Nullable
public SuggestionCallback getSuggestionCallback() { public SuggestionCallback getSuggestionCallback() {
return suggestionCallback; return suggestionCallback;
} }
/**
* Sets the suggestion callback (for dynamic tab completion) of this argument.
* <p>
* Note: This will not automatically filter arguments by user input.
*
* @param suggestionCallback The suggestion callback to set.
* @return 'this' for chaining
*/
@Beta @Beta
public Argument<T> setSuggestionCallback(@NotNull SuggestionCallback suggestionCallback) { public Argument<T> setSuggestionCallback(@NotNull SuggestionCallback suggestionCallback) {
this.suggestionCallback = suggestionCallback; this.suggestionCallback = suggestionCallback;
return this; return this;
} }
/**
* Check if the argument has a suggestion.
*
* @return If this argument has a suggestion.
*/
public boolean hasSuggestion() { public boolean hasSuggestion() {
return suggestionCallback != null; return suggestionCallback != null;
} }