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 ArgumentsRestrictioncreateArgumentsRestriction(Annotation annotation) Tries to create an arguments restriction from the given annotationprotected RangeRestrictioncreateByteRange(Annotation annotation) protected final AbstractCommonRestrictioncreateCommon(Annotation annotation) Handles converting all the basic range annotations into appropriate range restrictionsprotected RangeRestrictioncreateDoubleRange(Annotation annotation) protected RangeRestrictioncreateFloatRange(Annotation annotation) protected RangeRestrictioncreateIntegerRange(Annotation annotation) protected AbstractCommonRestrictioncreateLengthRange(Annotation annotation) protected RangeRestrictioncreateLexicalRange(Annotation annotation) protected RangeRestrictioncreateLongRange(Annotation annotation) final OptionRestrictioncreateOptionRestriction(Annotation annotation) Try and create an option restriction from the given annotationprotected RangeRestrictioncreateShortRange(Annotation annotation) protected AbstractCommonRestrictioncreateUnknownRange(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:OptionRestrictionFactoryTry and create an option restriction from the given annotation- Specified by:
createOptionRestrictionin interfaceOptionRestrictionFactory- Parameters:
annotation- Annotation- Returns:
- Option restriction or
nullif this factory cannot create a restriction from the given annotation
-
createArgumentsRestriction
Description copied from interface:ArgumentsRestrictionFactoryTries to create an arguments restriction from the given annotation- Specified by:
createArgumentsRestrictionin interfaceArgumentsRestrictionFactory- Parameters:
annotation- Annotation- Returns:
- Arguments restriction or
nullif 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:ArgumentsRestrictionFactoryGets a list of annotations that this factory can convert into arguments restrictions- Specified by:
supportedArgumentsAnnotationsin interfaceArgumentsRestrictionFactory- Returns:
- List of supported annotations
-
supportedOptionAnnotations
Description copied from interface:OptionRestrictionFactoryGets a list of annotations that this factory can convert into option restrictions- Specified by:
supportedOptionAnnotationsin interfaceOptionRestrictionFactory- Returns:
- List of supported annotations
-