Class AbstractCommonRestriction

java.lang.Object
com.github.rvesse.airline.restrictions.AbstractCommonRestriction
All Implemented Interfaces:
ArgumentsRestriction, OptionRestriction
Direct Known Subclasses:
AbstractAllowedValuesRestriction, AbstractRequiredUnlessRestriction, AbstractStringRestriction, IsRequiredRestriction, MultipleOfRestriction, None, OccurrencesRestriction, PartialRestriction, PathRestriction, PatternRestriction, PortRestriction, PositiveNegativeRestriction, RangeRestriction

public abstract class AbstractCommonRestriction extends Object implements OptionRestriction, ArgumentsRestriction
  • Constructor Details

    • AbstractCommonRestriction

      public AbstractCommonRestriction()
  • Method Details

    • finalValidate

      public <T> void finalValidate(ParseState<T> state, OptionMetadata option)
      Description copied from interface: OptionRestriction
      Method that is called after Airline has completed parsing

      This can be used to implement restrictions that require the final parser state to process

      Specified by:
      finalValidate in interface OptionRestriction
      Parameters:
      state - Parser state
      option - Option meta-data
    • postValidate

      public <T> void postValidate(ParseState<T> state, OptionMetadata option, Object value)
      Description copied from interface: OptionRestriction
      Method that is called after Airline has converted a string argument received into a strongly typed Java value
      Specified by:
      postValidate in interface OptionRestriction
      Parameters:
      state - Parser state
      option - Option meta-data
      value - Strongly typed value
    • preValidate

      public <T> void preValidate(ParseState<T> state, OptionMetadata option, String value)
      Description copied from interface: OptionRestriction
      Method that is called before Airline attempts to convert a string argument received into a strongly typed Java value
      Specified by:
      preValidate in interface OptionRestriction
      Parameters:
      state - Parser state
      option - Option meta-data
      value - String value
    • preValidate

      public <T> void preValidate(ParseState<T> state, ArgumentsMetadata arguments, String value)
      Description copied from interface: ArgumentsRestriction
      Method that is called before Airline attempts to convert a string argument received into a strongly typed Java value
      Specified by:
      preValidate in interface ArgumentsRestriction
      Parameters:
      state - Parser state
      arguments - Arguments meta-data
      value - String value
    • postValidate

      public <T> void postValidate(ParseState<T> state, ArgumentsMetadata arguments, Object value)
      Description copied from interface: ArgumentsRestriction
      Method that is called after Airline has converted a string argument received into a strongly typed Java value
      Specified by:
      postValidate in interface ArgumentsRestriction
      Parameters:
      state - Parser state
      arguments - Arguments meta-data
      value - Strongly typed value
    • finalValidate

      public <T> void finalValidate(ParseState<T> state, ArgumentsMetadata arguments)
      Description copied from interface: ArgumentsRestriction
      Method that is called after Airline has completed parsing

      This can be used to implement restrictions that require the final parser state to process

      Specified by:
      finalValidate in interface ArgumentsRestriction
      Parameters:
      state - Parser state
      arguments - Arguments meta-data
    • getOptionTitle

      public static <T> String getOptionTitle(ParseState<T> state, OptionMetadata option)
    • getArgumentTitle

      public static <T> String getArgumentTitle(ParseState<T> state, ArgumentsMetadata arguments)
    • getArgumentTitle

      public static <T> String getArgumentTitle(ArgumentsMetadata arguments, int argIndex)