I'm working on some dynamic filtering, and have this:
class Filterable {
def statusId
def secondaryFilterable
}
...
def filter = new Filter(validIds: [1], fieldName: 'statusId')
...
class Filter {
def validIds = [] as Set
def fieldName
private boolean containsFieldValue(input) {
def fieldValue = input."${fieldName}"
return fieldValue in validIds
}
}
Which works just fine for one property. However, now I need to filter by the secondary filterable - something like
def filter = new Filter(validIds: [1], fieldName: 'secondaryFilterable.statusId')
Which throws a groovy.lang.MissingPropertyException
. Any advice?