Class OccurrencesRestriction

java.lang.Object
com.github.rvesse.airline.restrictions.AbstractCommonRestriction
com.github.rvesse.airline.restrictions.common.OccurrencesRestriction
All Implemented Interfaces:
HelpHint, ArgumentsRestriction, OptionRestriction

public class OccurrencesRestriction extends AbstractCommonRestriction implements HelpHint
  • Field Details

    • occurrences

      private final int occurrences
    • maximum

      private final boolean maximum
  • Constructor Details

    • OccurrencesRestriction

      public OccurrencesRestriction(int occurrences, boolean maximum)
  • 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
      Overrides:
      finalValidate in class AbstractCommonRestriction
      Parameters:
      state - Parser state
      option - Option meta-data
    • 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
      Overrides:
      finalValidate in class AbstractCommonRestriction
      Parameters:
      state - Parser state
      arguments - Arguments meta-data
    • titles

      private <T> List<String> titles(ParseState<T> state, ArgumentsMetadata arguments)
    • getPreamble

      public String getPreamble()
      Description copied from interface: HelpHint
      Gets the preamble text that should be included
      Specified by:
      getPreamble in interface HelpHint
      Returns:
      Preamble text
    • getFormat

      public HelpFormat getFormat()
      Description copied from interface: HelpHint
      Gets the format of the provided help information
      Specified by:
      getFormat in interface HelpHint
      Returns:
      Help format
    • numContentBlocks

      public int numContentBlocks()
      Description copied from interface: HelpHint
      Gets the number of content blocks provided

      Help generators should consult the HelpHint.getFormat() return value to determine how to format the content blocks but they are not required to do so

      Specified by:
      numContentBlocks in interface HelpHint
      Returns:
      Number of content blocks
    • getContentBlock

      public String[] getContentBlock(int blockNumber)
      Description copied from interface: HelpHint
      Gets the content block with the given number
      Specified by:
      getContentBlock in interface HelpHint
      Parameters:
      blockNumber - Block number
      Returns:
      Content Block