Sweetener - Collection Restrictions - Part I
Search through the collection has always been a problem for developers and simple search enforced on the programmer writing many lines of code (Countless foreach, if-else constructions). Fortunately, class Collections
solves this problem. The integral part of this class is Criteria
and Restriction
mechanism, which allows for complex query conditions. The restrictions can be joined in chain by add method. Example criteria is shown below:
Criteria object created in this way can be used in filter
method on Collections