Interface ArgumentTypeResolver

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ArgumentTypeResolver
A resolver that specifies ArgumentType for each parameter depending on the parameter's type.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull ArgumentTypeResolver
    forHierarchyType(Class<?> type, com.mojang.brigadier.arguments.ArgumentType<?> argumentType)
    Creates a ArgumentTypeResolver that will return the same argument type for all parameters that match or extend a specific type
    static @NotNull ArgumentTypeResolver
    forType(Class<?> type, com.mojang.brigadier.arguments.ArgumentType<?> argumentType)
    Creates a ArgumentTypeResolver that will return the same argument type for all parameters that match a specific type
    @Nullable com.mojang.brigadier.arguments.ArgumentType<?>
    resolveArgType(@NotNull dev.velix.imperat.command.parameters.CommandParameter<?> parameter)
    Returns the argument type for the given parameter.
  • Method Details

    • forType

      @NotNull static @NotNull ArgumentTypeResolver forType(Class<?> type, com.mojang.brigadier.arguments.ArgumentType<?> argumentType)
      Creates a ArgumentTypeResolver that will return the same argument type for all parameters that match a specific type
      Parameters:
      type - Type to check for
      argumentType - The argument type to return
      Returns:
      The resolver factory
    • forHierarchyType

      @NotNull static @NotNull ArgumentTypeResolver forHierarchyType(Class<?> type, com.mojang.brigadier.arguments.ArgumentType<?> argumentType)
      Creates a ArgumentTypeResolver that will return the same argument type for all parameters that match or extend a specific type
      Parameters:
      type - Type to check for
      argumentType - The argument type to return
      Returns:
      The resolver factory
    • resolveArgType

      @Nullable @Nullable com.mojang.brigadier.arguments.ArgumentType<?> resolveArgType(@NotNull @NotNull dev.velix.imperat.command.parameters.CommandParameter<?> parameter)
      Returns the argument type for the given parameter. If unknown, it returns null
      Parameters:
      parameter - Parameter to create for
      Returns:
      The argument type