[stringtemplate-interest] Get parameters of a StringTemplate
palinf
palinf at free.fr
Mon Oct 22 09:50:20 PDT 2007
Hi,
I am trying to get the list of parameters (i.e. things which should be
replace in the template).
The method StringTemplate.getParameter() return null when no parameters
have been set.
I wrote this small piece of code to get them but I am sure this is not
the way to do it.
* private* List getParameters(StringTemplate st) {
List chunks = st.getChunks();
List l=* new* ArrayList();
* for* (Iterator iter = chunks.iterator();
iter.hasNext();) {
Object element = (Object) iter.next();
* if* (element* instanceof* ASTExpr) {
ASTExpr new_name = (ASTExpr) element;
l.add(new_name.toString().trim());
}
}
* return* l;
}
Is there a simplest way to do it ?
Regards,
Olivier
More information about the stringtemplate-interest
mailing list