[Spoon-discuss] How to build my template
Renaud Pawlak
renaud.pawlak at gmail.com
Thu Apr 16 18:16:49 CEST 2009
Hi Nicolas,
I guess that there is no ways for doing it with Spoon templates... You
need to write specific transformation code here.
/Renaud
On Fri, Apr 10, 2009 at 10:14 AM, Nicolas Pessemier
<nicolas.pessemier at inria.fr> wrote:
> 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.
>
>
> _______________________________________________
> Spoon-discuss mailing list
> Spoon-discuss at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/spoon-discuss
>
--
Renaud Pawlak, Professor
ISEP - 21 rue d’Assas 75006 Paris, France
Head of the Computer Engineering Department
Head of ISEP Research and Consulting for Computer Engineering
Phone: +33 149 54 52 78
Cell #1: +33 6 37 29 12 15
Cell #2: +33 6 36 47 06 01
Fax: +33 1 49 54 52 51
http://renaudpawlak.wikidot.com
More information about the Spoon-discuss
mailing list