Package org.jibx.custom
Class CustomizationCommandLineBase
java.lang.Object
org.jibx.custom.CustomizationCommandLineBase
- Direct Known Subclasses:
ClassCustomizationBase,CodeGenCommandLine,SchemaCommandLineBase
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classWrapper class for command line argument list. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String[]Ordered array of usage lines for parameters at this level.private ListList of specified classes or files.private FileTarget directory for output.private final String[]Complete array of usage lines.private booleanVerbose output flag.static final Class[]Array of method parameter classes for single String parameter.static final Class[]Array of classes for String and unmarshaller parameters.private static final intNumber of leading characters in usage lines checked for uniqueness. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCustomizationCommandLineBase(String[] lines) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract MapapplyOverrides(Map overmap) Apply map of override values to customizations read from file or created as default.protected booleanCheck extension parameter.protected voidFinish processing of command line parameters.Get extra arguments from command line.Get generate directory.protected String[]Get the usage lines describing command line parameters.booleanCheck if verbose output requested.protected abstract booleanloadCustomizations(String path) Load the customizations file.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.abstract voidPrint usage information.booleanprocessArgs(String[] args) Process command line arguments array.static booleanputKeyValue(String def, Map map) Set a key=value definition in a map.protected voidPrint any extension details.
-
Field Details
-
STRING_PARAMETER_ARRAY
Array of method parameter classes for single String parameter. -
STRING_UNMARSHALLER_PARAMETER_ARRAY
Array of classes for String and unmarshaller parameters. -
USAGE_UNIQUE_CHARS
private static final int USAGE_UNIQUE_CHARSNumber of leading characters in usage lines checked for uniqueness.- See Also:
-
COMMON_USAGE_LINES
Ordered array of usage lines for parameters at this level. -
m_usageLines
Complete array of usage lines. -
m_extraArgs
List of specified classes or files. -
m_generateDirectory
Target directory for output. -
m_verbose
private boolean m_verboseVerbose output flag.
-
-
Constructor Details
-
CustomizationCommandLineBase
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
Process command line arguments array.- Parameters:
args-- Returns:
trueif valid,falseif not- Throws:
JiBXExceptionIOException
-
getGeneratePath
Get generate directory.- Returns:
- directory
-
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
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:
trueif successful,falseif error
-
getUsageLines
Get the usage lines describing command line parameters.- Returns:
- lines
-
mergeUsageLines
Merge two arrays of strings, returning an ordered array containing all the strings from both provided arrays.- Parameters:
base-adds-- Returns:
- ordered merged
-
checkParameter
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:
trueif parameter processed,falseif unknown
-
finishParameters
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
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,nullif none- Returns:
trueif successful,falseif an error- Throws:
JiBXExceptionIOException
-
applyOverrides
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.
-