[Spoon-discuss] How to build my template
Nicolas Pessemier
nicolas.pessemier at inria.fr
Fri Apr 10 10:14:00 CEST 2009
Hi spooners,
I have a question about a template I'm trying to build.
Basically, what I want to do is transforming this annotated class
public class MovieImpl {
@model2code.generation.util.Collection
private Collection<Film> films;
@model2code.generation.util.Identifier
@model2code.generation.util.GetterSetter
private Integer filmId;
@model2code.generation.util.AddCRUD
public void addMovie(String name, Integer rating) {
}
}
into this transformed class
public class MovieImpl {
private Collection<Film> films;
private Integer filmId;
public Void addMovie(String name, Integer rating) {
Film element = new Film();
element.setFilmId(filmId);
element.setName(name);
element.setRating(rating);
films.add(element);
}
public void setFilmId(Integer filmId) {
this.filmId = filmId;
}
public Integer getFilmId() {
return filmId;
}
}
My main issue is to manage the add method arguments. I don't know the
number of arguments I may have here, so I don't see how I could manage
it with a simple StatementListTemplate :
Film element = new Film(); // ok
element.setFilmId(filmId); // ok
element.setName(name); // here is the issue
element.setRating(rating);
films.add(element); // ok
Is there any way to substitute an undetermine number of arguments
while filling in a method body.
Hope my question was clear enough.
Cheers,
Nicolas P.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gforge.inria.fr/pipermail/spoon-discuss/attachments/20090410/d4d0514c/attachment-0002.htm
More information about the Spoon-discuss
mailing list