Questions to new Filter API

Hello,

I have some questions to the new filter API.
Is it possible to create new filters is a dynamic way e.g instead of

container.addContainerFilter(new Or(new Equal("test", 1),new Equal("test", 3),new Equal("test", 2)));

something like


Or or = new Or();
or.getFilters().add((Filter)new Equal("test", 1));
or.getFilters().add((Filter)new Equal("test", 2));
or.getFilters().add((Filter)new Equal("test", 3));
or.getFilters().add((Filter)new Equal("test", 8));
container.addContainerFilter(or);

or

Or or = new Or();
Collection<Filter> filters = new ArrayList<Filter>();
filters.add(new Equal("test", 1));
filters.add(new Equal("test", 2));
or.getFilters().addAll(filters);
container.addContainerFilter(or);

Ok, both of my suggested solutions throws an UnsupportedOperationException… but the question is -
Is there another way to realize it ?

Thanks
Scott


Filter[] f = new Filter[3]
;
f[0]
 = new Equal("test", 1);
f[1]
 = new Equal("test", 2);
f[2]
 = new Equal("test", 3);
container.addContainerFilter(new Or(f));

Seems that this approach works :smiley:

Excellent post!!!