You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

And.java 985B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.data.util.filter;
  5. import com.vaadin.data.Container.Filter;
  6. import com.vaadin.data.Item;
  7. /**
  8. * A compound {@link Filter} that accepts an item if all of its filters accept
  9. * the item.
  10. *
  11. * If no filters are given, the filter should accept all items.
  12. *
  13. * This filter also directly supports in-memory filtering when all sub-filters
  14. * do so.
  15. *
  16. * @see Or
  17. *
  18. * @since 6.6
  19. */
  20. public final class And extends AbstractJunctionFilter {
  21. /**
  22. *
  23. * @param filters
  24. * filters of which the And filter will be composed
  25. */
  26. public And(Filter... filters) {
  27. super(filters);
  28. }
  29. @Override
  30. public boolean passesFilter(Object itemId, Item item)
  31. throws UnsupportedFilterException {
  32. for (Filter filter : getFilters()) {
  33. if (!filter.passesFilter(itemId, item)) {
  34. return false;
  35. }
  36. }
  37. return true;
  38. }
  39. }