Class ArgsParserImpl

java.lang.Object
org.refcodes.cli.ArgsParserImpl
All Implemented Interfaces:
ArgsParser, ArgsParserBuilder<ArgsParser>, ArgsProcessorBuilder<ArgsParser>, ArgsSyntaxAccessor, ArgsSyntaxAccessor.ArgsSyntaxBuilder<ArgsParser>, ArgsSyntaxAccessor.ArgsSyntaxMutator, ArgsSyntaxAccessor.ArgsSyntaxProperty, ArgumentEscapeCodeAccessor, ArgumentEscapeCodeAccessor.ArgumentEscapeCodeBuilder<ArgsParser>, ArgumentEscapeCodeAccessor.ArgumentEscapeCodeMutator, ArgumentEscapeCodeAccessor.ArgumentEscapeCodeProperty, BannerBorderEscapeCodeAccessor, BannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeBuilder<ArgsParser>, BannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeMutator, BannerBorderEscapeCodeAccessor.BannerBorderEscapeCodeProperty, BannerEscapeCodeAccessor, BannerEscapeCodeAccessor.BannerEscapeCodeBuilder<ArgsParser>, BannerEscapeCodeAccessor.BannerEscapeCodeMutator, BannerEscapeCodeAccessor.BannerEscapeCodeProperty, BannerFontAccessor, BannerFontAccessor.BannerFontBuilder<ArgsParser>, BannerFontAccessor.BannerFontMutator, BannerFontAccessor.BannerFontProperty, BannerFontPaletteAccessor, BannerFontPaletteAccessor.BannerFontPaletteBuilder<ArgsParser>, BannerFontPaletteAccessor.BannerFontPaletteMutator, BannerFontPaletteAccessor.BannerFontPaletteProperty, CliMetrics, CommandEscapeCodeAccessor, CommandEscapeCodeAccessor.CommandEscapeCodeBuilder<ArgsParser>, CommandEscapeCodeAccessor.CommandEscapeCodeMutator, CommandEscapeCodeAccessor.CommandEscapeCodeProperty, CopyrightAccessor, CopyrightAccessor.CopyrightBuilder<ArgsParser>, CopyrightAccessor.CopyrightMutator, CopyrightAccessor.CopyrightProperty, DescriptionEscapeCodeAccessor, DescriptionEscapeCodeAccessor.DescriptionEscapeCodeBuilder<ArgsParser>, DescriptionEscapeCodeAccessor.DescriptionEscapeCodeMutator, DescriptionEscapeCodeAccessor.DescriptionEscapeCodeProperty, ExamplesAccessor, ExamplesAccessor.ExamplesBuilder<ArgsParser>, ExamplesAccessor.ExamplesMutator, ExamplesAccessor.ExamplesProperty, LicenseAccessor, LicenseAccessor.LicenseBuilder<ArgsParser>, LicenseAccessor.LicenseMutator, LicenseAccessor.LicenseProperty, LineSeparatorEscapeCodeAccessor, LineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeBuilder<ArgsParser>, LineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeMutator, LineSeparatorEscapeCodeAccessor.LineSeparatorEscapeCodeProperty, LongOptionPrefixAccessor, LongOptionPrefixAccessor.LongOptionPrefixBuilder<ArgsParser>, LongOptionPrefixAccessor.LongOptionPrefixMutator, LongOptionPrefixAccessor.LongOptionPrefixProperty, Optionable, OptionEscapeCodeAccessor, OptionEscapeCodeAccessor.OptionEscapeCodeBuilder<ArgsParser>, OptionEscapeCodeAccessor.OptionEscapeCodeMutator, OptionEscapeCodeAccessor.OptionEscapeCodeProperty, ShortOptionPrefixAccessor, ShortOptionPrefixAccessor.ShortOptionPrefixBuilder<ArgsParser>, ShortOptionPrefixAccessor.ShortOptionPrefixMutator, ShortOptionPrefixAccessor.ShortOptionPrefixProperty, SyntaxMetricsAccessor, SyntaxMetricsAccessor.SyntaxMetricsBuilder<ArgsParser>, SyntaxMetricsAccessor.SyntaxMetricsMutator, SyntaxMetricsAccessor.SyntaxMetricsProperty, org.refcodes.mixin.ConsoleWidthAccessor, org.refcodes.mixin.ConsoleWidthAccessor.ConsoleWidthBuilder<ArgsParser>, org.refcodes.mixin.ConsoleWidthAccessor.ConsoleWidthMutator, org.refcodes.mixin.ConsoleWidthAccessor.ConsoleWidthProperty, org.refcodes.mixin.DescriptionAccessor, org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<ArgsParser>, org.refcodes.mixin.DescriptionAccessor.DescriptionMutator, org.refcodes.mixin.DescriptionAccessor.DescriptionProperty, org.refcodes.mixin.EscapeCodesStatusAccessor, org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<ArgsParser>, org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusMutator, org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusProperty, org.refcodes.mixin.LineBreakAccessor, org.refcodes.mixin.LineBreakAccessor.LineBreakBuilder<ArgsParser>, org.refcodes.mixin.LineBreakAccessor.LineBreakMutator, org.refcodes.mixin.LineBreakAccessor.LineBreakProperty, org.refcodes.mixin.MaxConsoleWidthAccessor, org.refcodes.mixin.MaxConsoleWidthAccessor.MaxConsoleWidthBuilder<ArgsParser>, org.refcodes.mixin.MaxConsoleWidthAccessor.MaxConsoleWidthMutator, org.refcodes.mixin.MaxConsoleWidthAccessor.MaxConsoleWidthProperty, org.refcodes.mixin.NameAccessor, org.refcodes.mixin.NameAccessor.NameBuilder<ArgsParser>, org.refcodes.mixin.NameAccessor.NameMutator, org.refcodes.mixin.NameAccessor.NameProperty, org.refcodes.mixin.Resetable, org.refcodes.mixin.ResetEscapeCodeAccessor, org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeBuilder<ArgsParser>, org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeMutator, org.refcodes.mixin.ResetEscapeCodeAccessor.ResetEscapeCodeProperty, org.refcodes.mixin.Schemable, org.refcodes.mixin.TitleAccessor, org.refcodes.mixin.TitleAccessor.TitleBuilder<ArgsParser>, org.refcodes.mixin.TitleAccessor.TitleMutator, org.refcodes.mixin.TitleAccessor.TitleProperty, org.refcodes.textual.TextBoxGridAccessor, org.refcodes.textual.TextBoxGridAccessor.TextBoxGridBuilder<ArgsParser>, org.refcodes.textual.TextBoxGridAccessor.TextBoxGridMutator, org.refcodes.textual.TextBoxGridAccessor.TextBoxGridProperty

public class ArgsParserImpl extends Object implements ArgsParser
A straightforward implementation of the ArgsParser interface. The constructor only provides means to set the required attributes as the attributes to be adjusted optionally are already sufficiently preconfigured. For adjusting them, a flavor of the Builder-Pattern is provided with which you can easily chain the configuration of this instance; as them methods return the instance of this class being configured. This helps to prevent the telescoping constructor anti-pattern.

The SyntaxNotation is pre-set with the SyntaxNotation.LOGICAL notation.

The console width id preconfigured with the console's width as determined by the SystemUtility.getTerminalWidth().

The standard out PrintStream is preconfigured with the System.out PrintStream.

The newline characters to be used for line breaks is "\r\n" on Windows machines and "\"n" on all other machines as of the SystemUtility.getLineBreak().

See Also:
  • "http://en.wikipedia.org/wiki/Builder_pattern"
  • Field Details

  • Constructor Details

    • ArgsParserImpl

      public ArgsParserImpl()
      Constructs the ArgsParser instance without any restrictions to the parsed arguments. The constructor only provides means to set the required attributes as the attributes to be adjusted optionally are already sufficiently preconfigured. For adjusting them, a flavor of the Builder-Pattern is provided with which you can easily chain the configuration of this instance; as them methods return the instance of this class being configured.
    • ArgsParserImpl

      public ArgsParserImpl(CliContext aCliCtx)
      Constructs the ArgsParser instance without any restrictions to the parsed arguments. The constructor only provides means to set the required attributes as the attributes to be adjusted optionally are already sufficiently preconfigured. For adjusting them, a flavor of the Builder-Pattern is provided with which you can easily chain the configuration of this instance; as them methods return the instance of this class being configured.
      Parameters:
      aCliCtx - The CliContext to be used for initializing.
    • ArgsParserImpl

      public ArgsParserImpl(Constituent aArgsSyntax)
      Constructs the ArgsParser instance with the given root Condition and the default SyntaxNotation.LOGICAL. The constructor only provides means to set the required attributes as the attributes to be adjusted optionally are already sufficiently preconfigured. For adjusting them, a flavor of the Builder-Pattern is provided with which you can easily chain the configuration of this instance; as them methods return the instance of this class being configured.
      Parameters:
      aArgsSyntax - The args syntax root Constituent node being the node from which parsing the command line arguments starts.
    • ArgsParserImpl

      public ArgsParserImpl(Constituent aArgsSyntax, CliContext aCliCtx)
      Constructs the ArgsParser instance with the given root Condition and the default SyntaxNotation.LOGICAL. The constructor only provides means to set the required attributes as the attributes to be adjusted optionally are already sufficiently preconfigured. For adjusting them, a flavor of the Builder-Pattern is provided with which you can easily chain the configuration of this instance; as them methods return the instance of this class being configured.
      Parameters:
      aArgsSyntax - The args syntax root Constituent node being the node from which parsing the command line arguments starts.
      aCliCtx - The CliContext to be used for initializing.
  • Method Details