Methods Summary |
---|
public static void | main(java.lang.String[] args)Method main for testing purposes. Parameter args is expected to a
an array of parameter declaration String. One parameter declaration
may declare multiple parameters according to the JDOQL parameter
declaration syntax. Calling
java com...jqlc.ParameterDeclarationHelper "int a, String b"
will print
Parameter types for >int a, String b<
int
String
QueryParser helper = new JDOQLParameterDeclarationParser();
for (int i = 0; i < args.length; i++) {
String text = args[i];
System.out.println("Parameter types for >" + text + "<");
for (Iterator types = helper.parameterTypeIterator(text);
types.hasNext();) {
System.out.println(" " + types.next());
}
}
|
public java.util.Iterator | parameterTypeIterator(java.lang.String text)Returns an iterator over the parameter types of the specified JDOQL
parameter declartion. The types are represented by their name, thus
the Iterator's next method returns Strings.
return new ParameterTypeIterator(parse(text));
|
private persistence.antlr.collections.AST | parse(java.lang.String text)Internal method parsing the JDOQL parameter declaration.
if (text == null) {
return null;
}
// return value
AST paramsAST = null;
// error message helper
ErrorMsg errorMsg = new ErrorMsg();
// create parser
JQLParser parser = JQLC.createStringParser(text, errorMsg);
try {
// start parsing
parser.parseParameters();
// get the AST representation
paramsAST = parser.getAST();
}
catch (ANTLRException ex) {
// handle any exceptions thrown by lexer or parser
JQLParser.handleANTLRException(ex, errorMsg);
}
return paramsAST;
|