Class NumericArgumentTypeHandler<S extends CommandSource>
java.lang.Object
studio.mevera.imperat.command.arguments.type.handlers.NumericArgumentTypeHandler<S>
- Type Parameters:
S- the source type
- All Implemented Interfaces:
ArgumentTypeHandler<S>,Prioritizable
public final class NumericArgumentTypeHandler<S extends CommandSource>
extends Object
implements ArgumentTypeHandler<S>
Handler for resolving
ArgumentType instances for numeric types.
This handler supports all standard Java numeric types including:
byte, short, int, long, float, double and their wrapper classes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines if this handler can resolve the given type.@NotNull Priority<T> @Nullable ArgumentType<S,T> resolve(@NotNull Type type, @NotNull TypeWrap<?> wrap, @NotNull ArgumentTypeLookup<S> lookup) Resolves anArgumentTypefor the given type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface studio.mevera.imperat.command.arguments.type.ArgumentTypeHandler
onRegisteringResolver
-
Constructor Details
-
NumericArgumentTypeHandler
public NumericArgumentTypeHandler()
-
-
Method Details
-
canHandle
Description copied from interface:ArgumentTypeHandlerDetermines if this handler can resolve the given type.- Specified by:
canHandlein interfaceArgumentTypeHandler<S extends CommandSource>- Parameters:
type- the raw type to checkwrap- the wrapped type for convenience, providing additional type introspection- Returns:
- true if this handler can handle the type
-
resolve
@Nullable public <T> @Nullable ArgumentType<S,T> resolve(@NotNull @NotNull Type type, @NotNull @NotNull TypeWrap<?> wrap, @NotNull @NotNull ArgumentTypeLookup<S> lookup) Description copied from interface:ArgumentTypeHandlerResolves anArgumentTypefor the given type.This method is called only if
ArgumentTypeHandler.canHandle(Type, TypeWrap)returns true. The providedArgumentTypeLookupcan be used to recursively resolve component types for generic types (e.g., the element type of a collection).- Specified by:
resolvein interfaceArgumentTypeHandler<S extends CommandSource>- Type Parameters:
T- the resolved type- Parameters:
type- the type to resolvewrap- the wrapped type for conveniencelookup- the lookup function for resolving nested/component types- Returns:
- the resolved ArgumentType, or null if resolution fails despite canHandle returning true
-
getPriority
- Specified by:
getPriorityin interfacePrioritizable
-