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 971B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. public boolean passesFilter(Object itemId, Item item)
  30. throws UnsupportedFilterException {
  31. for (Filter filter : getFilters()) {
  32. if (!filter.passesFilter(itemId, item)) {
  33. return false;
  34. }
  35. }
  36. return true;
  37. }
  38. }