Class BaseParameterType<S extends Source,T>
java.lang.Object
studio.mevera.imperat.util.TypeCapturer
studio.mevera.imperat.command.parameters.type.BaseParameterType<S,T>
- Type Parameters:
S- The type of the source from which the command originates.T- The type of the parameter being handled.
- All Implemented Interfaces:
ParameterType<S,T>
- Direct Known Subclasses:
ConstrainedParameterTypeDecorator,ParameterArray,ParameterBoolean,ParameterCollection,ParameterCommand,ParameterCompletableFuture,ParameterEnum,ParameterFlag,ParameterMap,ParameterNumber,ParameterOptional,ParameterString,ParameterUUID
public abstract class BaseParameterType<S extends Source,T>
extends TypeCapturer
implements ParameterType<S,T>
Base class for defining parameter types in a command processing framework.
This class handles the basic functionality for managing type information and
suggestions for parameters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionA list storing suggestions for parameter types in a command processing framework.protected final TypeEncapsulates type information for the parameter being handled. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new BaseParameterType with an automatedTypeWrapBaseParameterType(Class<T> type) Constructs a new BaseParameterType with the given TypeWrap.BaseParameterType(Type type) Constructs a new BaseParameterType with the given TypeWrap. -
Method Summary
Modifier and TypeMethodDescriptionReturns the suggestion resolver associated with this parameter type.booleanmatchesInput(int rawPosition, Context<S> context, CommandParameter<S> parameter) Determines whether the provided input matches the expected format or criteria for a given command parameter.type()Retrieves the Type associated with this BaseParameterType.@NotNull ParameterType<S,T> withSuggestions(String... suggestions) Adds the provided suggestions to the current list of suggestions for this parameter type.Methods inherited from class studio.mevera.imperat.util.TypeCapturer
extractType, extractTypeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface studio.mevera.imperat.command.parameters.type.ParameterType
equalsExactly, getConsumedArguments, isGreedy, isRelatedToType, resolve, supplyDefaultValue, wrappedType
-
Field Details
-
type
Encapsulates type information for the parameter being handled. This instance is used to collect and manage type-related information and operations specific to the parameter type. -
suggestions
A list storing suggestions for parameter types in a command processing framework.
-
-
Constructor Details
-
BaseParameterType
public BaseParameterType()Constructs a new BaseParameterType with an automatedTypeWrap -
BaseParameterType
Constructs a new BaseParameterType with the given TypeWrap.- Parameters:
type- The type of the parameter.
-
BaseParameterType
Constructs a new BaseParameterType with the given TypeWrap.- Parameters:
type- The type of the parameter.
-
-
Method Details
-
type
Retrieves the Type associated with this BaseParameterType.- Specified by:
typein interfaceParameterType<S extends Source,T> - Returns:
- the Type associated with this parameter type.
-
getSuggestionResolver
Returns the suggestion resolver associated with this parameter type.- Specified by:
getSuggestionResolverin interfaceParameterType<S extends Source,T> - Returns:
- the suggestion resolver for generating suggestions based on the parameter type.
-
matchesInput
Determines whether the provided input matches the expected format or criteria for a given command parameter. this is used duringCommandTree.contextMatch(Context, ArgumentInput)- Specified by:
matchesInputin interfaceParameterType<S extends Source,T> - Parameters:
rawPosition- The raw position of the argument in the input.context- The context to be matched, providing necessary information about the command execution environment.parameter- The command parameter that provides context for the input handling.- Returns:
- true if the input matches the expected criteria; false otherwise.
-
withSuggestions
Adds the provided suggestions to the current list of suggestions for this parameter type.- Specified by:
withSuggestionsin interfaceParameterType<S extends Source,T> - Parameters:
suggestions- The array of suggestions to be added.- Returns:
- The current instance of the parameter type with the added suggestions.
-