How to get the type of a variable in a pattern Follow
Hi, i'm stuck with a pattern :
I'd like to check the type of a variable in a pattern, inside a groovy file.
For example this would be the code :
GenericValue partyAcctgPreference = from('PartyAcctgPreference').where(parameters).queryOne()
partyAcctgPreference.myAttribute = //...
I would like a pattern that allows me to detect that myAttribute is an attribute of a GenericValue.
i know there is something like what i want for methods, such as these patterns :
Is there something similar for variable type ?
Thanks berofehand, i'm really stuck with this one
Please sign in to leave a comment.
There is no method you need, but you can create your own pattern and use it like:
The condition can be implemented based on this answer:
and Peter's comments.
Hi, thanks for your answer.
I think i get the big picture, but i have little to no kotlin skills.
I will try an keep you updated.
Thanks again for your answer !
So i tried something like this but it doesn't seem to work :
In patterns :
The FieldTypeCondition class :
Sorry to bother the forum again, but do you have any idea what's wrong with this code ?
So i managed to make it work, like so :
Thanks for the help !