Package org.springframework.rules.closure

Examples of org.springframework.rules.closure.ElementGenerator.run()


   * @return The objects that match, or a empty collection if none match
   */
  public Collection findAll(Iterator it, Constraint constraint) {
    ElementGenerator finder = new IteratorTemplate(it).findAll(constraint);
    final Collection results = new ArrayList();
    finder.run(new Block() {
      protected void handle(Object element) {
        results.add(element);
      }
    });
    return results;
View Full Code Here


    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() {
View Full Code Here

    finder = template.findAll(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Element");
      }
    });
    finder.run(new Block() {
      protected void handle(Object o) {
        fail("Should not be called");
      }
    });
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.