Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[henshin-dev] Working with list attributes

Hi all,

I added support for working with list attributes. Say you have an attribute of type int with an upper bound of -1. There are two possible ways for handling these attribute values:

- as constants: you use as attribute value a comma-separated list of constants surrounded by brackets, e.g. [1,2,3]. Henshin will automatically treat this as a list of integers.

- matching the lists by parameters: say you have a parameter x in your rule, you can match it with the list attribute value of an object. You can then use JavaScript to manipulate the list. For example, you can write

x.add(new Integer(4)); x;

to add 4 to the integer list. Note that the "return"-value of the expression must be the (modified) list.

Cheers,
Christian

PS: I will commit the code in the evening. The new version should be available in 24-48 hours at the nightly builds update site. Also, there are two new tests for this new feature.



Back to the top