Package org.springframework.rules.constraint

Examples of org.springframework.rules.constraint.Constraint


    collection.add("Item 2");
    collection.add("Item 3");
    collection.add("Item 4");
    collection.add("Item 5");
    IteratorTemplate template = new IteratorTemplate(collection);
    assertTrue(template.allTrue(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Item");
      }
    }));
    assertEquals(false, template.allTrue(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Element");
      }
    }));
  }
View Full Code Here


    collection.add("Item 2");
    collection.add("Item 3");
    collection.add("Item 4");
    collection.add("Item 5");
    IteratorTemplate template = new IteratorTemplate(collection);
    assertTrue(template.anyTrue(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Item 5");
      }
    }));
    assertEquals(false, template.anyTrue(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Element");
      }
    }));
  }
View Full Code Here

    collection.add("Item 2");
    collection.add("Item 3");
    collection.add("Item 4");
    collection.add("Item 5");
    IteratorTemplate template = new IteratorTemplate(collection);
    assertEquals("Item 4", template.findFirst(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Item 4");
      }
    }));
    assertEquals(null, template.findFirst(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Element");
      }
    }));
  }
View Full Code Here

    collection.add("Item 2");
    collection.add("Item 3");
    collection.add("Item 4");
    collection.add("Item 5");
    IteratorTemplate template = new IteratorTemplate(collection);
    ElementGenerator finder = template.findAll(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Item 4");
      }
    });
    finder.run(new Block() {
      protected void handle(Object o) {
        assertEquals("Item 4", o);
      }
    });
    finder = template.findAll(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Element");
      }
    });
    finder.run(new Block() {
View Full Code Here

        runUntilCounter = 0;
        template.runUntil(new Block() {
            protected void handle(Object o) {
                runUntilCounter++;
            }
        }, new Constraint() {
      public boolean test(Object o) {
        return o.equals("Item 4");
      }
    });
    assertEquals(3, runUntilCounter);
View Full Code Here

     */
  void visit(CompoundConstraint compoundConstraint) {
    Iterator it = compoundConstraint.iterator();
        String compoundMessage = getMessageCode(compoundConstraint);
    while (it.hasNext()) {
      Constraint p = (Constraint) it.next();
      visitorSupport.invokeVisit(this, p);
      if (it.hasNext()) {
        add(compoundMessage, null, compoundMessage);
      }
    }
View Full Code Here

    }

    public void testFilter() {
        setUpBinding();
        ListModel model = cb.getModel();
        cbb.setFilter(new Constraint() {
            public boolean test(Object argument) {
                return "1".equals(argument) || "4".equals(argument);
            }
        });
        assertEquals(2, model.getSize());
View Full Code Here

    public void testFilterWithContext() {
        ComboBoxBinder binder = new ComboBoxBinder();
        binder.setSelectableItems(SELECTABLEITEMS);
        Map context = new HashMap();
        Constraint filter = new Constraint() {
            public boolean test(Object argument) {
                return "1".equals(argument) || "4".equals(argument);
            }
        };
        context.put(ComboBoxBinder.FILTER_KEY, filter);
View Full Code Here

TOP

Related Classes of org.springframework.rules.constraint.Constraint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.