001package com.avaje.ebean; 002 003/** 004 * Used to process a query result one bean at a time via a callback to this 005 * visitor. 006 * <p> 007 * If you wish to stop further processing return false from the accept method. 008 * </p> 009 * <p> 010 * Unlike findList() and findSet() using a QueryResultVisitor does not require 011 * all the beans in the query result to be held in memory at once. This makes 012 * QueryResultVisitor useful for processing large queries. 013 * </p> 014 * 015 * <pre>{@code 016 * 017 * Query<Customer> query = server.find(Customer.class) 018 * .where().eq("status", Status.NEW) 019 * .order().asc("id"); 020 * 021 * query.findEach((Customer customer) -> { 022 * 023 * // do something with customer 024 * System.out.println("-- visit " + customer); 025 * }); 026 * 027 * }</pre> 028 * 029 * @param <T> 030 * the type of entity bean being queried. 031 */ 032public interface QueryEachConsumer<T> { 033 034 /** 035 * Process the bean. 036 * 037 * @param bean 038 * the entity bean to process 039 */ 040 void accept(T bean); 041}