Class AnnotationHelper
java.lang.Object
studio.mevera.imperat.annotations.base.AnnotationHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull DefaultValueProviderdeduceOptionalValueSupplier(ParameterElement parameter, Default defaultAnnotation, DefaultProvider provider, DefaultValueProvider fallback) static @NotNull DefaultValueProvidergetOptionalValueSupplier(Class<? extends DefaultValueProvider> supplierClass) static <S extends CommandSource>
@NotNull StringgetParamName(ImperatConfig<S> imperat, ParameterElement parameter) static <S extends CommandSource>
@NotNull StringgetParamName(ImperatConfig<S> imperat, ParameterElement parameter, @Nullable Named named, @Nullable Flag flag, @Nullable Switch switchAnnotation) static booleanisAbnormalClass(Class<?> element) static booleanisAbnormalClass(ParseElement<?> parseElement) Checks if the type is not a concrete class (Interface, enum, abstract class, etc.)static <S extends CommandSource>
Object[]loadParameterInstances(Imperat<S> dispatcher, S source, ExecutionContext<S> context, MethodElement method) The function loads the full parameters of a method and resolves all context, such as senders, flags, regular arguments, etc.
-
Constructor Details
-
AnnotationHelper
public AnnotationHelper()
-
-
Method Details
-
loadParameterInstances
public static <S extends CommandSource> Object[] loadParameterInstances(Imperat<S> dispatcher, S source, ExecutionContext<S> context, MethodElement method) throws CommandException The function loads the full parameters of a method and resolves all context, such as senders, flags, regular arguments, etc.Checks arguments and resolves their context, if the parameter or type contains CommandContext then it will get the context resolver from the imperat's config instance.
- Type Parameters:
S- the source- Parameters:
dispatcher- the imperat instancesource- the source of the commandcontext- the execution context for a command, responsible for resolving and managing command arguments, flags, and their values during command execution.method- the method we're operating on- Returns:
- the array of parameter instances after loading and context resolving
- Throws:
CommandException- if resolution fails
-
getParamName
@NotNull public static <S extends CommandSource> @NotNull String getParamName(ImperatConfig<S> imperat, ParameterElement parameter, @Nullable @Nullable Named named, @Nullable @Nullable Flag flag, @Nullable @Nullable Switch switchAnnotation) -
getParamName
@NotNull public static <S extends CommandSource> @NotNull String getParamName(ImperatConfig<S> imperat, ParameterElement parameter) -
getOptionalValueSupplier
@NotNull public static @NotNull DefaultValueProvider getOptionalValueSupplier(Class<? extends DefaultValueProvider> supplierClass) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException -
deduceOptionalValueSupplier
@NotNull public static @NotNull DefaultValueProvider deduceOptionalValueSupplier(ParameterElement parameter, Default defaultAnnotation, DefaultProvider provider, DefaultValueProvider fallback) throws CommandException - Throws:
CommandException
-
isAbnormalClass
Checks if the type is not a concrete class (Interface, enum, abstract class, etc.)- Parameters:
parseElement- the parse element- Returns:
- true if the type is not a concrete class, false otherwise
-
isAbnormalClass
-