Package com.mrivanplays.jdcf.builtin
Class CaseArgumentResolver<T>
- java.lang.Object
-
- com.mrivanplays.jdcf.builtin.CaseArgumentResolver<T>
-
- Type Parameters:
T
- argument to resolve to
- All Implemented Interfaces:
ArgumentResolver<T>
public final class CaseArgumentResolver<T> extends java.lang.Object implements ArgumentResolver<T>
Represents a casedArgumentResolver
. Works by retrieving the specified argument's specified case in the specified map. It isn't recommended to use this if you have only 1 case as the JVM will allocate more memory because of the map.
-
-
Constructor Summary
Constructors Constructor Description CaseArgumentResolver(java.util.Map<java.lang.String,T> cases)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
resolve(@NotNull ArgumentResolverContext context)
Resolves the input argument into the type this resolver resolves.
-
-
-
Constructor Detail
-
CaseArgumentResolver
public CaseArgumentResolver(java.util.Map<java.lang.String,T> cases)
-
-
Method Detail
-
resolve
@Nullable public T resolve(@NotNull @NotNull ArgumentResolverContext context) throws java.lang.Exception
Resolves the input argument into the type this resolver resolves. This method may throw exceptions which will triggerRestArgumentAction.orElse(Consumer)
withFailReason
ofARGUMENT_PARSED_NOT_TYPE
if used uponCommandArguments.next(ArgumentResolver)
.- Specified by:
resolve
in interfaceArgumentResolver<T>
- Parameters:
context
- context containing data about the argument- Returns:
- a resolved argument, or null.
- Throws:
java.lang.Exception
-
-