Class ConstrainedParameterTypeDecorator<S extends Source,T>

java.lang.Object
studio.mevera.imperat.util.TypeCapturer
studio.mevera.imperat.command.parameters.type.BaseParameterType<S,T>
studio.mevera.imperat.command.parameters.ConstrainedParameterTypeDecorator<S,T>
All Implemented Interfaces:
ParameterType<S,T>

public final class ConstrainedParameterTypeDecorator<S extends Source,T> extends BaseParameterType<S,T>
  • Method Details

    • of

      public static <S extends Source, T> ConstrainedParameterTypeDecorator<S,T> of(ParameterType<S,T> original, Set<String> allowedValues, boolean caseSensitive)
    • of

      public static <S extends Source, T> ConstrainedParameterTypeDecorator<S,T> of(ParameterType<S,T> original, Set<String> allowedValues)
    • resolve

      @Nullable public T resolve(@NotNull @NotNull ExecutionContext<S> context, @NotNull @NotNull CommandInputStream<S> commandInputStream, @NotNull @NotNull String input) throws ImperatException
      Description copied from interface: ParameterType
      Resolves the parameter value from the given input string, using the provided execution context and input stream.
      Parameters:
      context - the execution context.
      commandInputStream - the command input stream.
      input - the raw input string.
      Returns:
      the resolved value, or null if resolution fails.
      Throws:
      ImperatException - if resolution fails due to an error.
    • getSuggestionResolver

      public SuggestionResolver<S> getSuggestionResolver()
      Description copied from class: BaseParameterType
      Returns the suggestion resolver associated with this parameter type.
      Specified by:
      getSuggestionResolver in interface ParameterType<S extends Source,T>
      Overrides:
      getSuggestionResolver in class BaseParameterType<S extends Source,T>
      Returns:
      the suggestion resolver for generating suggestions based on the parameter type.
    • isRelatedToType

      public boolean isRelatedToType(Type type)
      Description copied from interface: ParameterType
      Checks if the given type is related to this parameter type.
      Parameters:
      type - the type to check.
      Returns:
      true if the types are related, false otherwise.
    • equalsExactly

      public boolean equalsExactly(Type type)
      Description copied from interface: ParameterType
      Checks if the given type exactly matches this parameter type.
      Parameters:
      type - the type to check.
      Returns:
      true if the types match exactly, false otherwise.
    • wrappedType

      public TypeWrap<T> wrappedType()
      Description copied from interface: ParameterType
      Gets a TypeWrap for the handled type.
      Returns:
      the wrapped type.