* For each object specifier, a new java object <code>Specifier</code>
* is added to the passed <code>out</code> List parameter.
*/
public List parseSpecifiers(String str) throws PropertiesException {
List result = new ArrayList();
// Cursor on the given string: marks the parser position
int cursor = 0;
while (cursor < str.length()) {
int commaPos = str.indexOf(ARGUMENT_SEPARATOR, cursor);
if (commaPos == -1) {
commaPos = str.length();
}
String arg = str.substring(cursor, commaPos);
int openBracketPos = arg.indexOf('(');
int closedBracketPos = arg.indexOf(')');
Specifier s = new Specifier();
if ((openBracketPos == -1) && (closedBracketPos == -1)) {
// No brackets: no argument
s.setClassName(arg);
} else {
// An open bracket, then something, then a closed bracket:
// the class name is before the open bracket, and the
// argument is between brackets.
if ((openBracketPos != -1) && (closedBracketPos != -1)
&& (openBracketPos < closedBracketPos)) {
s.setClassName(arg.substring(0, openBracketPos));
Object a[] = new Object[1];
a[0] = arg.substring(openBracketPos + 1,
closedBracketPos);
s.setArgs(a);
} else {
throw new PropertiesException(
"Ill-formed specifier: mismatched parentheses.");
}
}
cursor = commaPos + 1;
result.add(s);
} // while (cursor)
return result;
}