Class AppHelper

java.lang.Object
org.refcodes.archetype.CliHelper
org.refcodes.archetype.AppHelper
All Implemented Interfaces:
org.refcodes.cli.Optionable, org.refcodes.mixin.VerboseAccessor

public class AppHelper extends CliHelper
The AppHelper is a stripped down CliHelper intended to be used by GUI applications which must(!) avoid (to link to) java.awt which might not be available on a target platform such as Android. Background: For mere nerd purposes, the CliHelper comes with a full blown ASCII-Art banner which uses an AWT graphics context to convert text fonts or graphics to ASCII-Art. The AWT graphics context is not available on Android and causes applications built with the GraalVM and Gluon's substrate to crash as of an unavailable "fontmanager symbol".
  • Constructor Details

    • AppHelper

      public AppHelper(String[] aArgs, char aShortOptionPrefix, String aLongOptionPrefix, org.refcodes.cli.Condition aArgsSyntax, org.refcodes.cli.SyntaxNotation aSyntaxNotation, Collection<org.refcodes.cli.Example> aExamples, String aDefaultConfig, org.refcodes.runtime.ConfigLocator aConfigLocator, Class<?> aResourceLocator, String aName, String aTitle, String aPasswordPrompt, String aDescription, String aCopyrightNote, String aLicenseNote, org.refcodes.textual.Font aBannerFont, char[] aBannerFontPalette, boolean aVerboseFallback, org.refcodes.logger.RuntimeLogger aLogger, Consumer<Integer> aShutdownHook)
      Creates a new AppHelper using the provided application's RuntimeLogger so that logs produced by the AppHelper are logged according to the application's RuntimeLogger configuration (depending on the RuntimeLogger.ini file).
      Parameters:
      aArgs - The command line arguments.
      aShortOptionPrefix - The short options' prefix to be set.
      aLongOptionPrefix - The long options' prefix to be set.
      aArgsSyntax - The root elelemt of your command line syntax.
      aSyntaxNotation - The SyntaxNotation to use.
      aExamples - The Example examples to use when printing out the help.
      aDefaultConfig - The name to your default config file.
      aConfigLocator - The ConfigLocator to use when locating the configuration file (defaults to ConfigLocator.DEFAULT.
      aResourceLocator - The application's Class which to use when loading resources (of the according module) by invoking Class.getResourceAsStream(String).
      aName - The name of your application.
      aTitle - The title of the application.
      aPasswordPrompt - The prompt to use when requesting a password.
      aDescription - The description to use when printing out the help.
      aCopyrightNote - The copyright being applied.
      aLicenseNote - The license for the application.
      aBannerFont - The font for the banner to use.
      aBannerFontPalette - The ASCII color palette for the banner to use.
      aVerboseFallback - The fallback verbose mode if the verbose mode cannot be determined otherwise.
      aLogger - The application's logger.
      aShutdownHook - When provided, then this hook is called instead of System.exit(int) (it is up to the shutdown hook to terminate the application in the end).
  • Method Details

    • builder

      public static AppHelper.Builder builder()
      Creates builder to build AppHelper.
      Returns:
      created builder
    • printBanner

      protected void printBanner()
      Prints the application's banner to the console.
      Overrides:
      printBanner in class CliHelper
    • printHelp

      protected void printHelp()
      Prints the application's help to the console.
      Overrides:
      printHelp in class CliHelper