|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectthings.common.commands.CommandLineProcessor
public class CommandLineProcessor
A fancy command line processor. The rules are: There are values, options, and entities.
Entities are numbered by position and accessible from an ArrayList by number.
Values are not numbered, but are available in the entity map. Values differ from entities in that they have an exposed (not escaped or quoted) = (equal) sign. They are split into name/value pairs. If an = precedes or suffixes the term, it'll assume it is a name only-the value will be the same as the name. VALUES ARE NOT CASE SENSITIVE and the names are stored as LOWER CASE.
Options are one or more character flags preceded by a single dash. They are stored in their own map.
Quotes can enclose terms. Accent '`' (ASCII #96) is the escape. Double accent will escape itself. Carot (^) enclosed terms will be resolved against the property view. Backslash is the escape. Double backslash will escape itself.
Version History
EPG - Initial - 5 JUN 07
Field Summary | |
---|---|
static int |
ESCAPE_CHARACTER
This is the escape character. |
static int |
MAX_CHARACTER
This is the largest (by value) character recognized. |
static int |
NORMAL_CHARACTER
A NORMAL_CHARCTER. |
static int |
OPTION_CHARACTER
This is the option character. |
static int |
PROPERTY_CHARACTER
This is the property character. |
Constructor Summary | |
---|---|
CommandLineProcessor()
|
Method Summary | |
---|---|
CommandLine |
process(java.io.Reader target,
ThingsPropertyView properties)
Process a command line. |
CommandLine |
process(java.lang.String[] target,
ThingsPropertyView properties)
Process a command line. |
static CommandLine |
processStatic(java.io.Reader target,
ThingsPropertyView properties)
Process a command line. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PROPERTY_CHARACTER
public static final int ESCAPE_CHARACTER
public static final int OPTION_CHARACTER
public static final int MAX_CHARACTER
public static final int NORMAL_CHARACTER
Constructor Detail |
---|
public CommandLineProcessor()
Method Detail |
---|
public static CommandLine processStatic(java.io.Reader target, ThingsPropertyView properties) throws ThingsException
target
- A Reader source.properties
- Properties for replacements.
ThingsException
CommandLine
public CommandLine process(java.io.Reader target, ThingsPropertyView properties) throws ThingsException
target
- A Reader source.properties
- Properties for replacements.
ThingsException
CommandLine
public CommandLine process(java.lang.String[] target, ThingsPropertyView properties) throws ThingsException
target
- As an array of strings.properties
- Properties for replacements.
ThingsException
CommandLine
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |