Module com.github.rvesse.airline
Class RangeRestrictionFactory
java.lang.Object
com.github.rvesse.airline.restrictions.factories.RangeRestrictionFactory
- All Implemented Interfaces:
ArgumentsRestrictionFactory
,OptionRestrictionFactory
public class RangeRestrictionFactory
extends Object
implements OptionRestrictionFactory, ArgumentsRestrictionFactory
Factory which generates range restrictions from a variety of different range
annotations
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Comparator
<Object> private static final Comparator
<Object> private static final Comparator
<Object> private static final Comparator
<Object> private static final Comparator
<Object> private static final Comparator
<Object> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ArgumentsRestriction
createArgumentsRestriction
(Annotation annotation) Tries to create an arguments restriction from the given annotationprotected RangeRestriction
createByteRange
(Annotation annotation) protected final AbstractCommonRestriction
createCommon
(Annotation annotation) Handles converting all the basic range annotations into appropriate range restrictionsprotected RangeRestriction
createDoubleRange
(Annotation annotation) protected RangeRestriction
createFloatRange
(Annotation annotation) protected RangeRestriction
createIntegerRange
(Annotation annotation) protected AbstractCommonRestriction
createLengthRange
(Annotation annotation) protected RangeRestriction
createLexicalRange
(Annotation annotation) protected RangeRestriction
createLongRange
(Annotation annotation) final OptionRestriction
createOptionRestriction
(Annotation annotation) Try and create an option restriction from the given annotationprotected RangeRestriction
createShortRange
(Annotation annotation) protected AbstractCommonRestriction
createUnknownRange
(Annotation annotation) Handles turning unknown annotations into range restrictions, derived factories can extend this to add support for additional range restrictionsprotected List
<Class<? extends Annotation>> List
<Class<? extends Annotation>> Gets a list of annotations that this factory can convert into arguments restrictionsList
<Class<? extends Annotation>> Gets a list of annotations that this factory can convert into option restrictions
-
Field Details
-
LONG_COMPARATOR
-
INTEGER_COMPARATOR
-
SHORT_COMPARATOR
-
BYTE_COMPARATOR
-
DOUBLE_COMPARATOR
-
FLOAT_COMPARATOR
-
-
Constructor Details
-
RangeRestrictionFactory
public RangeRestrictionFactory()
-
-
Method Details
-
createOptionRestriction
Description copied from interface:OptionRestrictionFactory
Try and create an option restriction from the given annotation- Specified by:
createOptionRestriction
in interfaceOptionRestrictionFactory
- Parameters:
annotation
- Annotation- Returns:
- Option restriction or
null
if this factory cannot create a restriction from the given annotation
-
createArgumentsRestriction
Description copied from interface:ArgumentsRestrictionFactory
Tries to create an arguments restriction from the given annotation- Specified by:
createArgumentsRestriction
in interfaceArgumentsRestrictionFactory
- Parameters:
annotation
- Annotation- Returns:
- Arguments restriction or
null
if this factory cannot create a restriction from the given annotation
-
createCommon
Handles converting all the basic range annotations into appropriate range restrictions- Parameters:
annotation
- Annotation to create range from- Returns:
- Range restriction
-
createUnknownRange
Handles turning unknown annotations into range restrictions, derived factories can extend this to add support for additional range restrictions- Parameters:
annotation
- Annotation to create range from- Returns:
- Range restriction or null if not a supported annotation
-
createLengthRange
-
createLexicalRange
-
createFloatRange
-
createDoubleRange
-
createByteRange
-
createShortRange
-
createIntegerRange
-
createLongRange
-
supportedAnnotations
-
supportedArgumentsAnnotations
Description copied from interface:ArgumentsRestrictionFactory
Gets a list of annotations that this factory can convert into arguments restrictions- Specified by:
supportedArgumentsAnnotations
in interfaceArgumentsRestrictionFactory
- Returns:
- List of supported annotations
-
supportedOptionAnnotations
Description copied from interface:OptionRestrictionFactory
Gets a list of annotations that this factory can convert into option restrictions- Specified by:
supportedOptionAnnotations
in interfaceOptionRestrictionFactory
- Returns:
- List of supported annotations
-