Check that Type is of collection type
My usecase is quite simple - if a property of my class is a list, or collection, or map, then I'd like to add method clear<PropertyName>.
I tried using $IF$ with condition
but it does not work.
Any help?
I tried using $IF$ with condition
(node, genContext, operationContext)->boolean { node.type.isInstanceOf(ListType); }
but it does not work.
Any help?
Please sign in to leave a comment.
For the expression 'node', if you're trying to check if the type is conforming to some known type, it's better to use 'isSubtype' or even 'coerce' to required type.
For 'type' link of a property declaration your code is correct, in case the link is an aggregation and you specify property type as an instance of ListType concept.
Please provide more relevant information so we can help you.
You probably know that you can switch on Transient Model saving and check the content of the model on which this generator macro is applied.