JPad Functions

JPad provides a class specifically to make life easier for JPad users. See javadoc for function specifications. The JPad class allows:

Running Terminal Or Console Commands

Running a command, capturing it's output and reporting back the result as a string can be achieved using the cmd function:

Console Output

Writing Objects to CSV Files

The JPad.writeCsv function writes objects to CSV using the JPad object to table converter.

Console Output

Caching results to prevent repeating work

Jpad.cache can be used to prevent repeating expensive calls on each run The callable only gets ran if a cache entry does not already exist.

Accepting User Input / Command Line Arguments

JPad profiles functions to allow easy script input in multiple forms:

  • Command Line Arguments
  • Terminal Text Entry
  • GUI Dialog Entry
It does this using the JPad.getArg(args, idx, title, defaultValue) function. The arguments are:
  • args - String[] array holding command line arguments.
  • idx - index position into arguments.
  • title - title of value that is wanted..
  • defaultValue - default value shown to user and assumed if user enters nothing.

This means whether the user wants to run it interactively in the GUI or terminal that it will always work. Like so

Interactive Terminal

Interactive GUI

jpad user input dialog

Command Line