QJCC homepage

biz.chitec.quarterback.gjsa
Class Str2ObjParamParser

java.lang.Object
  extended bybiz.chitec.quarterback.gjsa.Str2ObjParamParser

public final class Str2ObjParamParser
extends java.lang.Object

Parameter parser. Parses parameters which are separated through whitespaces Methods are separated in two halfs: Those beginning with "parse" work directly on Str2ObjParamParser's "line" and actualize "i" so that it points behind the parsed part of the String, those called "getXXX" expect a String parameter which is parsed completely.

Str2ObjParamParser is an instancizable helper class for Str2ObjParser. Itself and its methods are declared public because external parsers for other objects (which may be declared in other packages) must know about them.

Str2ObjParamParser knows itself about the following object types which it can parse:

Any other objects can be parsed through external ClassParser objects which must be included through Str2ObjParser.addClassParser().

Version:
$Id: 5b7748338b1616c4511edbeb09bdc05c34ec98f4 $
Author:
Dirk Hillbrecht 1997-1999, chitec/Dirk Hillbrecht 2000. Distributed under the terms of the GNU LGPL.
See Also:
Str2ObjParser, Obj2StrParser

Field Summary
private  int i
           
private  java.lang.String line
           
private  java.lang.String modifier
           
private static java.lang.Class[] onestringclassarray
           
 
Constructor Summary
Str2ObjParamParser()
           
Str2ObjParamParser(java.lang.String s)
           
Str2ObjParamParser(java.lang.String m, java.lang.String s)
           
 
Method Summary
 boolean findConstant(java.lang.String linerest, java.lang.String identifier)
           
 boolean findIdentifier(java.lang.String linerest, java.lang.String identifier)
           
 java.lang.String getLine()
           
 java.util.List getList(java.lang.String s)
          get a vector
 java.util.List getList(java.lang.String s, java.util.List l)
           
 java.util.Map getMap(boolean stringkey, java.lang.String s)
          returns a Map
 java.util.Map getMap(boolean stringkey, java.lang.String s, java.util.Map m)
           
 java.lang.Object getObject(java.lang.String s)
           
 boolean parsedCompletely()
           
 java.lang.String parseEnclosed()
          parses parenthensis.
 java.util.List parseList()
           
 java.util.List parseList(java.util.List l)
           
 java.util.Map parseMap(boolean stringkey)
           
 java.util.Map parseMap(boolean stringkey, java.util.Map m)
           
 java.lang.String parseModifier(java.lang.String defaultvalue)
          Parses modifier.
 java.lang.Number parseNumber()
          parses numbers.
 java.lang.Object parseObject()
          parses a complete Object, e.g. one parameter of a List.
 java.lang.Object parseOldstyleHashkey()
          parses a hash key.
 java.util.ResourceBundle parseResourceBundle()
           
 java.util.Set parseSet()
           
 java.util.Set parseSet(java.util.Set s)
           
 java.lang.String parseString()
          parse a String.
 java.lang.Throwable parseThrowable()
          Parse the string representation of a Throwable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

onestringclassarray

private static final java.lang.Class[] onestringclassarray

line

private java.lang.String line

modifier

private java.lang.String modifier

i

private int i
Constructor Detail

Str2ObjParamParser

public Str2ObjParamParser(java.lang.String m,
                          java.lang.String s)

Str2ObjParamParser

public Str2ObjParamParser(java.lang.String s)

Str2ObjParamParser

public Str2ObjParamParser()
Method Detail

getLine

public java.lang.String getLine()

parsedCompletely

public boolean parsedCompletely()

parseModifier

public java.lang.String parseModifier(java.lang.String defaultvalue)
Parses modifier. A modifier is put into square brackets ("[]") between identifier and parameters. Its evaluation is up to the handling method of the parser for the identifier.

Starts one char before the "[", finds the belonging "]", delivers everything between and sets "i" on the "]". The content is trimmed.

If no modifier is found, the given default value is returned.


parseEnclosed

public java.lang.String parseEnclosed()
parses parenthensis. Starts one char before a "(", finds the belonging ")", delivers everything between and sets "i" behind the ")". Parenthensis may contain parenthensis inside, those are overread correctly.


parseNumber

public java.lang.Number parseNumber()
parses numbers. Parses positive or negative Integers, Longs or Doubles. Doubles must contain a ".", a sign must be the first character, a Long must end with "l" or "L".


parseString

public java.lang.String parseString()
parse a String. String must be enclosed in '"'. Method starts on opening '"'. A string which contains itself a '"' must double it. Backslash must be escaped by a backslash, Backslash-n is a newline. Other escape sequences are not known.


findIdentifier

public boolean findIdentifier(java.lang.String linerest,
                              java.lang.String identifier)

findConstant

public boolean findConstant(java.lang.String linerest,
                            java.lang.String identifier)

parseObject

public java.lang.Object parseObject()
parses a complete Object, e.g. one parameter of a List. Note that for objects which contain other objects, Str2ObjParamParser invokes a new instance of itself for the included object.


parseThrowable

public java.lang.Throwable parseThrowable()
Parse the string representation of a Throwable. This method uses introspection mechanisms.


parseOldstyleHashkey

public java.lang.Object parseOldstyleHashkey()
parses a hash key. Delivers key, reads over "="


getObject

public java.lang.Object getObject(java.lang.String s)

parseMap

public java.util.Map parseMap(boolean stringkey)

parseMap

public java.util.Map parseMap(boolean stringkey,
                              java.util.Map m)

parseResourceBundle

public java.util.ResourceBundle parseResourceBundle()

getMap

public java.util.Map getMap(boolean stringkey,
                            java.lang.String s)
returns a Map


getMap

public java.util.Map getMap(boolean stringkey,
                            java.lang.String s,
                            java.util.Map m)

parseList

public java.util.List parseList()

parseList

public java.util.List parseList(java.util.List l)

parseSet

public java.util.Set parseSet()

parseSet

public java.util.Set parseSet(java.util.Set s)

getList

public java.util.List getList(java.lang.String s)
get a vector


getList

public java.util.List getList(java.lang.String s,
                              java.util.List l)

QJCC homepage