Class AnnotationParser<S extends Source>
java.lang.Object
studio.mevera.imperat.annotations.base.AnnotationParser<S>
- Type Parameters:
S- the command-sender valueType
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends Source>
AnnotationParser<S>defaultParser(@NotNull Imperat<S> dispatcher) abstract <A extends Annotation>
@Nullable AnnotationReplacer<A>getAnnotationReplacer(Class<A> type) Fetches theAnnotationReplacermapped to the entered annotation valueType.abstract booleanhasAnnotationReplacerFor(Class<? extends Annotation> type) Checks if the specific valueType of annotation entered has aAnnotationReplacerfor it in the internal registry for replacersfinal booleanisEntryPointAnnotation(Class<? extends Annotation> annotation) abstract booleanisKnownAnnotation(Class<? extends Annotation> annotationType) Checks the internal registry whether the valueType of annotation entered is known/registered or not.abstract <T> voidparseCommandClass(T instance) Parses annotated command class of valueType AnnotationParser intoCommandthen register it usingImperatabstract <T> voidparseThrowableHandlerClass(T instance) Parses annotated throwable handling class into a set ofThrowableResolverthat are automatically injected into the instance ofImperatthat you're using.abstract <A extends Annotation>
voidregisterAnnotationReplacer(Class<A> type, AnnotationReplacer<A> replacer) RegistersAnnotationReplacerabstract voidregisterAnnotations(Class<? extends Annotation>... types) 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.
-
Field Details
-
imperat
-
-
Method Details
-
defaultParser
public static <S extends Source> AnnotationParser<S> defaultParser(@NotNull @NotNull Imperat<S> dispatcher) -
parseCommandClass
public abstract <T> void parseCommandClass(T instance) Parses annotated command class of valueType AnnotationParser intoCommandthen register it usingImperat- Type Parameters:
T- the valueType of annotated command class to parse- Parameters:
instance- the instance of the command class
-
parseThrowableHandlerClass
public abstract <T> void parseThrowableHandlerClass(T instance) Parses annotated throwable handling class into a set ofThrowableResolverthat are automatically injected into the instance ofImperatthat you're using.- Type Parameters:
T- the type of the instance of the throwable-handling class.- Parameters:
instance- the instance of the throwable-handling class.
-
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:
types- the valueType of annotation
-
registerAnnotationReplacer
public abstract <A extends Annotation> void registerAnnotationReplacer(Class<A> type, AnnotationReplacer<A> replacer) RegistersAnnotationReplacer- Parameters:
type- the valueType to replace the annotation byreplacer- the replacer
-
isKnownAnnotation
Checks the internal registry whether the valueType of annotation entered is known/registered or not.- Parameters:
annotationType- the valueType of annotation to enter- Returns:
- whether the valueType of annotation entered is known/registered or not.
-
hasAnnotationReplacerFor
Checks if the specific valueType of annotation entered has aAnnotationReplacerfor it in the internal registry for replacers- Parameters:
type- the valueType of annotation entered- Returns:
- Whether the there's an annotation replacer for the valueType entered.
-
getAnnotationReplacer
@Nullable public abstract <A extends Annotation> @Nullable AnnotationReplacer<A> getAnnotationReplacer(Class<A> type) Fetches theAnnotationReplacermapped to the entered annotation valueType.- Type Parameters:
A- the annotation valueType parameter- Parameters:
type- the valueType of annotation- Returns:
- the
AnnotationReplacermapped to the entered annotation valueType.
-
isEntryPointAnnotation
-
getImperat
-