Class AnnotationParameterDecorator<S extends Source>
java.lang.Object
studio.mevera.imperat.command.parameters.InputParameter<S>
studio.mevera.imperat.annotations.parameters.AnnotationParameterDecorator<S>
- All Implemented Interfaces:
AnnotatedParameter<S>,DescriptionHolder,CommandParameter<S>,PermissionHolder
public final class AnnotationParameterDecorator<S extends Source>
extends InputParameter<S>
implements AnnotatedParameter<S>
-
Field Summary
Fields inherited from class studio.mevera.imperat.command.parameters.InputParameter
description, flag, format, greedy, index, name, optional, optionalValueSupplier, parentCommand, permission, suggestionResolver, type -
Method Summary
Modifier and TypeMethodDescriptionCasts the parameter to a flag parametercopyWithDifferentPosition(int newPosition) Creates a copy of this parameter with a different position.static <S extends Source>
AnnotationParameterDecorator<S>decorate(CommandParameter<S> parameter, ParameterElement element) format()Formats the usage parameter*<A extends Annotation>
AgetAnnotation(Class<A> clazz) Get the instance of specific annotation@Unmodifiable Collection<? extends Annotation>booleanisFlag()Methods inherited from class studio.mevera.imperat.command.parameters.InputParameter
addPermission, asCommand, describe, description, equals, getDefaultValueSupplier, getPermissions, getSinglePermission, getSuggestionResolver, hashCode, isGreedy, isGreedyString, isOptional, name, parent, parent, position, position, setFormat, setSinglePermission, similarTo, toString, type, wrappedTypeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface studio.mevera.imperat.annotations.parameters.AnnotatedParameter
hasAnnotationMethods inherited from interface studio.mevera.imperat.command.parameters.CommandParameter
asAnnotated, asCommand, asNumeric, getDefaultValueSupplier, getSinglePermission, getSuggestionResolver, isAnnotated, isCommand, isGreedy, isGreedyString, isNumeric, isOptional, isRequired, name, parent, parent, position, position, setFormat, setSinglePermission, similarTo, type, valueType, wrappedTypeMethods inherited from interface studio.mevera.imperat.command.DescriptionHolder
describe, describe, descriptionMethods inherited from interface studio.mevera.imperat.command.PermissionHolder
addPermission, getPermissions, hasPermission
-
Method Details
-
decorate
public static <S extends Source> AnnotationParameterDecorator<S> decorate(CommandParameter<S> parameter, ParameterElement element) -
getAnnotation
Get the instance of specific annotation- Specified by:
getAnnotationin interfaceAnnotatedParameter<S extends Source>- Type Parameters:
A- the valueType of the annotation- Parameters:
clazz- the valueType of annotation- Returns:
- the specific instance of an annotation of a certain valueType AnnotationParameterDecorator
-
getAnnotations
- Specified by:
getAnnotationsin interfaceAnnotatedParameter<S extends Source>- Returns:
- the annotations associated with this parameter
-
format
Formats the usage parameter*- Specified by:
formatin interfaceCommandParameter<S extends Source>- Overrides:
formatin classInputParameter<S extends Source>- Returns:
- the formatted parameter
- See Also:
-
asFlagParameter
Casts the parameter to a flag parameter- Specified by:
asFlagParameterin interfaceCommandParameter<S extends Source>- Overrides:
asFlagParameterin classInputParameter<S extends Source>- Returns:
- the parameter as a flag
-
isFlag
public boolean isFlag()- Specified by:
isFlagin interfaceCommandParameter<S extends Source>- Overrides:
isFlagin classInputParameter<S extends Source>- Returns:
- checks whether this parameter is a flag
-
copyWithDifferentPosition
Creates a copy of this parameter with a different position. Useful for commands that have multiple syntaxes.- Specified by:
copyWithDifferentPositionin interfaceCommandParameter<S extends Source>- Parameters:
newPosition- the new position to set- Returns:
- a copy of this parameter with the new position
-