001package io.ebean.event; 002 003import io.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. 015 * </p> 016 */ 017public interface BeanFindController { 018 019 /** 020 * Return true if this BeanPersistController should be registered for events 021 * on this entity type. 022 */ 023 boolean isRegisterFor(Class<?> cls); 024 025 /** 026 * Return true if this controller should intercept and process this find request. 027 * <p> 028 * Return false to allow the default behavior to process the request. 029 */ 030 boolean isInterceptFind(BeanQueryRequest<?> request); 031 032 /** 033 * Find a bean using its id or unique predicate. 034 */ 035 <T> T find(BeanQueryRequest<T> request); 036 037 /** 038 * Return true if this controller should intercept and process this findMany request. 039 * <p> 040 * Return false to allow the default behavior to process the request. 041 */ 042 boolean isInterceptFindMany(BeanQueryRequest<?> request); 043 044 /** 045 * Return a List, Set or Map for the given find request. 046 * <p> 047 * Note the returning object is cast to a List Set or Map so you do need to 048 * get the return type right. 049 * </p> 050 */ 051 <T> BeanCollection<T> findMany(BeanQueryRequest<T> request); 052 053}