I had to write some OGNL to look something up in a table, sort of like using a C# dictionary. This was easy enough:
#mapping=#{"XYZ":"1234","YZX":"5678"},
#mapping.get(this.A.toString())
But now my requirements have changed. Now I need to make some more complex rules, and I'm not sure if OGNL can do it. I have several requirements for the updated expression. I now have two separate values and their combinations to worry about. We'll call the values A and B. The rules are something like this:
If I have a list of all possible values for A and B, I can make a really big hashtable with each concatenation of them and the proper value to return for each case. Seems like this would be a lot easier if I could use wildcards. Does anyone have a thought on how to implement this, or if it's possible with OGNL?
Honestly, I'd probably move this logic out to a java method. You might eventually figure out how to do what you want in ognl - like ? style null handlers also supported - but why bother?
It supports projections and as many recursive evaluations as java language supports but I don't know. . I'd opt to move this elsewhere, and I've made significant contributions / bug fixes / changes to ognl itself and know it well.