|
|||||||||||
| PREV NEXT | FRAMES NO FRAMES | ||||||||||
See:
Description
| Packages | |
| com.nevelex.app.args | Re-usable Command Pattern implementation for processing command-line arguments passed to a Java Application. |
Command Pattern implementation for processing command-line arguments passed to a Java Application.
Design Overview
The Nevelex Arguments is based on the Command Pattern described
in the Design Pattern: Elements of Reusable Object-Oriented Software book.
The GoF Command Pattern is shown in the following figure.
Figure 2 details the current implementation of this package. It is up to the you, the application developer, to
ArgumentCommand interface.
ArgumentProcessor using the
registerArgumentCommand method.
ArgumentProcessor) to process all the command-line arguments using the
processArguments (or
processArguments) method.
ArgumentConsumer Interface
The ArgumentConsumer should be used
when command-line arguments are required for the application to function.
It provides the contract for initializing and validating the application's
processing of the arguments. More specifically,
initArgumentState
is called at the start of processing and
checkArgumentState
is called at the completion of processing.
Example Code
Example code is availabe in the com.nevelex.app.args.test package.
The example/test code should be run as follows (assumes the JAR files are in the current directory):
java -cp NevArgs.jar:NevArgs-example.jar com.nevelex.app.args.test.ArgTest --help
|
|||||||||||
| PREV NEXT | FRAMES NO FRAMES | ||||||||||