org.wurbelizer
Class ArgScanner

java.lang.Object
  extended by org.wurbelizer.ArgScanner

public class ArgScanner
extends Object

Utility class to scan for arguments and to do variable translation.

Arguments usually are separated by whitespaces. However, sometimes arguments must include whitespaces, i.e. must be quoted. There are two kinds quotes:

double-quotes like @{code "test: $remote == --remote"}. The $remote will be translated. A single-quote in a double-quoted string is allowed.

single-quotes like @{code --orderby='" ORDER BY " + FIELD_ID + " DESC"'}. No translation will take place and such args may contain double-quotes.

Double-quotes in a double-quoted string must be quoted with a backslash. Same is true for single-quotes in a single quoted string. A backslash is written as \\.

Notice that variable translation takes place after the arguments have been separated. Thus, a variable may contain quotes and these quotes need not be escaped.


Constructor Summary
ArgScanner(String str, Properties otherProps)
          Creates an instance of an arg scanner.
 
Method Summary
 String next()
          Gets the next argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArgScanner

public ArgScanner(String str,
                  Properties otherProps)
Creates an instance of an arg scanner.

Parameters:
str - the text containing the args
otherProps - extra properties if != null, else default properties only.
Method Detail

next

public String next()
Gets the next argument.

Returns:
the next argument or null if no more args found


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de