Package studio.mevera.imperat
Interface AnnotationInjector<S extends Source>
- Type Parameters:
S- the type of the command source (e.g., console, player, etc.)
- All Known Subinterfaces:
Imperat<S>
- All Known Implementing Classes:
BaseImperat
public interface AnnotationInjector<S extends Source>
This interface provides mechanisms for injecting and managing annotations within
a command parsing and execution framework. It is designed to allow the registration
and replacement of annotations and provides the capability to set a custom
AnnotationParser.-
Method Summary
Modifier and TypeMethodDescriptionFetches the annotation parser<A extends Annotation>
voidregisterAnnotationReplacer(Class<A> type, AnnotationReplacer<A> replacer) Registers annotation replacervoidregisterAnnotations(Class<? extends Annotation>... type) Registers a valueType of annotations so that it can be detected byAnnotationReader, it's useful as it allows that valueType of annotation to be recognized as a true Imperat-related annotation to be used in something like checking if aCommandParameteris annotated and checks for the annotations it has.default voidregisterThrowableHandler(Object object) Parses the instance's class that containsExceptionHandlerannotation into multiple throwable resolvers to be registered and injected intoImperatvoidsetAnnotationParser(AnnotationParser<S> parser) Changes the instance ofAnnotationParser
-
Method Details
-
getAnnotationParser
AnnotationParser<S> getAnnotationParser()Fetches the annotation parser- Returns:
- the annotation parser instance.
- See Also:
-
setAnnotationParser
Changes the instance ofAnnotationParser- Parameters:
parser- the parser
-
registerAnnotations
Registers a valueType of annotations so that it can be detected byAnnotationReader, it's useful as it allows that valueType of annotation to be recognized as a true Imperat-related annotation to be used in something like checking if aCommandParameteris annotated and checks for the annotations it has.- Parameters:
type- the valueType of annotation
-
registerAnnotationReplacer
<A extends Annotation> void registerAnnotationReplacer(Class<A> type, AnnotationReplacer<A> replacer) Registers annotation replacer- Type Parameters:
A- the valueType of annotation to replace- Parameters:
type- the valueType to replace the annotation byreplacer- the replacer
-
registerThrowableHandler
Parses the instance's class that containsExceptionHandlerannotation into multiple throwable resolvers to be registered and injected intoImperat- Parameters:
object- the annotated class containing the exception handling methods.
-