001package com.avaje.ebean.event; 002 003import com.avaje.ebean.bean.BeanCollection; 004 005/** 006 * Used to override the finding implementation for a bean. 007 * <p> 008 * For beans that are not in a JDBC data source you can implement this handle 009 * bean finding. For example, read a log file building each entry as a bean and 010 * returning that. 011 * </p> 012 * <p> 013 * There are a number of internal BeanFinders in Ebean to return meta data from 014 * Ebean at runtime such as query execution statistics etc. See the beans in 015 * com.avaje.ebean.meta and finders in com.avaje.ebean.server.meta. 016 * </p> 017 */ 018public interface BeanFindController { 019 020 /** 021 * Return true if this BeanPersistController should be registered for events 022 * on this entity type. 023 */ 024 boolean isRegisterFor(Class<?> cls); 025 026 /** 027 * Return true if this controller should intercept and process this find request. 028 * 029 * Return false to allow the default behavior to process the request. 030 */ 031 boolean isInterceptFind(BeanQueryRequest<?> request); 032 033 /** 034 * Find a bean using its id or unique predicate. 035 */ 036 <T> T find(BeanQueryRequest<T> request); 037 038 /** 039 * Return true if this controller should intercept and process this findMany request. 040 * 041 * Return false to allow the default behavior to process the request. 042 */ 043 boolean isInterceptFindMany(BeanQueryRequest<?> request); 044 045 /** 046 * Return a List, Set or Map for the given find request. 047 * <p> 048 * Note the returning object is cast to a List Set or Map so you do need to 049 * get the return type right. 050 * </p> 051 */ 052 <T> BeanCollection<T> findMany(BeanQueryRequest<T> request); 053 054}