Class CustomizationCommandLineBase

java.lang.Object
org.jibx.custom.CustomizationCommandLineBase
Direct Known Subclasses:
ClassCustomizationBase, CodeGenCommandLine, SchemaCommandLineBase

public abstract class CustomizationCommandLineBase extends Object
Command line processor for all types of customizable tools. This just provides the basic handling of a customizations file, target directory, and overrides of values in the customizations root object. TODO: should extend SchemaCommandLinebase
Author:
Dennis M. Sosnoski
  • Field Details

    • STRING_PARAMETER_ARRAY

      public static final Class[] STRING_PARAMETER_ARRAY
      Array of method parameter classes for single String parameter.
    • STRING_UNMARSHALLER_PARAMETER_ARRAY

      public static final Class[] STRING_UNMARSHALLER_PARAMETER_ARRAY
      Array of classes for String and unmarshaller parameters.
    • USAGE_UNIQUE_CHARS

      private static final int USAGE_UNIQUE_CHARS
      Number of leading characters in usage lines checked for uniqueness.
      See Also:
    • COMMON_USAGE_LINES

      private static final String[] COMMON_USAGE_LINES
      Ordered array of usage lines for parameters at this level.
    • m_usageLines

      private final String[] m_usageLines
      Complete array of usage lines.
    • m_extraArgs

      private List m_extraArgs
      List of specified classes or files.
    • m_generateDirectory

      private File m_generateDirectory
      Target directory for output.
    • m_verbose

      private boolean m_verbose
      Verbose output flag.
  • Constructor Details

    • CustomizationCommandLineBase

      protected CustomizationCommandLineBase(String[] lines)
      Constructor. This just merges the usage line defined by subclasses with those at this level, and checks for any duplication (by comparing the first n characters of the lines).
      Parameters:
      lines -
  • Method Details

    • processArgs

      public boolean processArgs(String[] args) throws JiBXException, IOException
      Process command line arguments array.
      Parameters:
      args -
      Returns:
      true if valid, false if not
      Throws:
      JiBXException
      IOException
    • getGeneratePath

      public File getGeneratePath()
      Get generate directory.
      Returns:
      directory
    • getExtraArgs

      public List getExtraArgs()
      Get extra arguments from command line. These extra arguments must follow all parameter flags.
      Returns:
      args
    • isVerbose

      public boolean isVerbose()
      Check if verbose output requested.
      Returns:
      verbose
    • putKeyValue

      public static boolean putKeyValue(String def, Map map)
      Set a key=value definition in a map. This is a command line processing assist method that prints an error message directly if the expected format is not found.
      Parameters:
      def -
      map -
      Returns:
      true if successful, false if error
    • getUsageLines

      protected String[] getUsageLines()
      Get the usage lines describing command line parameters.
      Returns:
      lines
    • mergeUsageLines

      protected static String[] mergeUsageLines(String[] base, String[] adds)
      Merge two arrays of strings, returning an ordered array containing all the strings from both provided arrays.
      Parameters:
      base -
      adds -
      Returns:
      ordered merged
    • checkParameter

      protected boolean checkParameter(CustomizationCommandLineBase.ArgList alist)
      Check extension parameter. This method may be overridden by subclasses to process parameters beyond those known to this base class.
      Parameters:
      alist - argument list
      Returns:
      true if parameter processed, false if unknown
    • finishParameters

      protected void finishParameters(CustomizationCommandLineBase.ArgList alist)
      Finish processing of command line parameters. This method may be overridden by subclasses to implement any added processing after all the command line parameters have been handled.
      Parameters:
      alist -
    • verboseDetails

      protected void verboseDetails()
      Print any extension details. This method may be overridden by subclasses to print extension parameter values for verbose output.
    • loadCustomizations

      protected abstract boolean loadCustomizations(String path) throws JiBXException, IOException
      Load the customizations file. This method must load the specified customizations file, or create a default customizations instance, of the appropriate type.
      Parameters:
      path - customization file path, null if none
      Returns:
      true if successful, false if an error
      Throws:
      JiBXException
      IOException
    • applyOverrides

      protected abstract Map applyOverrides(Map overmap)
      Apply map of override values to customizations read from file or created as default.
      Parameters:
      overmap - override key-value map
      Returns:
      map for key/values not recognized
    • printUsage

      public abstract void printUsage()
      Print usage information.