Record Class Cli

java.lang.Object
java.lang.Record
com.github.dakusui.symfonion.cli.Cli
Record Components:
subcommand - A sub command to be executed by this object.
source - A source file to be processed.
sink - A sink (output) file to which processed result should be written.
routeRequest - An object to specify routing of MIDI signals.
midiInRegexPatterns - An object that maps logical midi input port name to a device name.
midiOutRegexPatterns - An object that maps logical midi output port name to a device name.
barFilter - A predicate that filters musical bars. Used with -c and -p options.
measureFilter - A predicate that filters musical measures. Used with -x and -q options.
partFilter - A predicate that filters parts.
options - An object that models command line options.
symfonion - This application’s facade object.

public record Cli(Subcommand subcommand, File source, File sink, MidiRouteRequest routeRequest, Map<String,Pattern> midiInRegexPatterns, Map<String,Pattern> midiOutRegexPatterns, Predicate<Bar> barFilter, Predicate<Measure> measureFilter, Predicate<String> partFilter, org.apache.commons.cli.Options options, Symfonion symfonion) extends Record

A class that models a single CLI invocation.

  • Constructor Details

  • Method Details

    • invoke

      public void invoke(PrintStream stdout, InputStream in) throws IOException

      Invokes this object.

      Parameters:
      stdout - A print stream to which the output of the execution goes.
      in - An input stream from which the executed subcommand reads data.
      Throws:
      IOException - A failure detected during execution.
    • invoke

      public static int invoke(PrintStream stdout, PrintStream stderr, String... args)

      Invokes the SyMFONION application with given command line arguments.

      Parameters:
      stdout - A print stream to which stdout data are printed.
      stderr - A print stream to which stderr data are printed.
      args - Command line arguments.
      Returns:
      An exit code.
    • cli

      public static Cli.Builder cli(String... args)

      A synonym for new Builder(String…​ args). Prefer this over directly calling new Builder(String…​ args) for readability’s sake.

      Parameters:
      args - Commandline arguments
      Returns:
      A new Cli.Builder object
    • main

      public static void main(String... args)

      The application’s entry point.

      Parameters:
      args - Given command line arguments.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • subcommand

      public Subcommand subcommand()
      Returns the value of the subcommand record component.
      Returns:
      the value of the subcommand record component
    • source

      public File source()
      Returns the value of the source record component.
      Returns:
      the value of the source record component
    • sink

      public File sink()
      Returns the value of the sink record component.
      Returns:
      the value of the sink record component
    • routeRequest

      public MidiRouteRequest routeRequest()
      Returns the value of the routeRequest record component.
      Returns:
      the value of the routeRequest record component
    • midiInRegexPatterns

      public Map<String,Pattern> midiInRegexPatterns()
      Returns the value of the midiInRegexPatterns record component.
      Returns:
      the value of the midiInRegexPatterns record component
    • midiOutRegexPatterns

      public Map<String,Pattern> midiOutRegexPatterns()
      Returns the value of the midiOutRegexPatterns record component.
      Returns:
      the value of the midiOutRegexPatterns record component
    • barFilter

      public Predicate<Bar> barFilter()
      Returns the value of the barFilter record component.
      Returns:
      the value of the barFilter record component
    • measureFilter

      public Predicate<Measure> measureFilter()
      Returns the value of the measureFilter record component.
      Returns:
      the value of the measureFilter record component
    • partFilter

      public Predicate<String> partFilter()
      Returns the value of the partFilter record component.
      Returns:
      the value of the partFilter record component
    • options

      public org.apache.commons.cli.Options options()
      Returns the value of the options record component.
      Returns:
      the value of the options record component
    • symfonion

      public Symfonion symfonion()
      Returns the value of the symfonion record component.
      Returns:
      the value of the symfonion record component