@InstallSubject(value="loadDelegate") public interface InstanceLoader<E> extends DataLoader
Modifier and Type | Interface and Description |
---|---|
static class |
InstanceLoader.PostLoadEvent<T>
Event sent after successful loading of an entity instance, merging it into
DataContext and setting to
the container. |
static class |
InstanceLoader.PreLoadEvent<T>
Event sent before loading an entity instance.
|
Modifier and Type | Method and Description |
---|---|
io.jmix.core.common.event.Subscription |
addPostLoadListener(java.util.function.Consumer<InstanceLoader.PostLoadEvent<E>> listener)
Adds a listener to
InstanceLoader.PostLoadEvent . |
io.jmix.core.common.event.Subscription |
addPreLoadListener(java.util.function.Consumer<InstanceLoader.PreLoadEvent<E>> listener)
Adds a listener to
InstanceLoader.PreLoadEvent . |
InstanceContainer<E> |
getContainer()
Returns the container which accepts the loaded entity.
|
java.lang.Object |
getEntityId()
Returns id of the entity to load.
|
io.jmix.core.FetchPlan |
getFetchPlan()
Returns the fetch plan used for loading the entity.
|
java.util.function.Function<io.jmix.core.LoadContext<E>,E> |
getLoadDelegate()
Returns a function which will be used to load data instead of standard implementation.
|
void |
setContainer(InstanceContainer<E> container)
Sets the container which accepts the loaded entity.
|
void |
setEntityId(java.lang.Object entityId)
Sets the id of the entity to load.
|
void |
setFetchPlan(io.jmix.core.FetchPlan fetchPlan)
Sets the fetch plan to use for loading the entity.
|
void |
setFetchPlan(java.lang.String fetchPlanName)
Sets the name of the fetch plan to use for loading the entity.
|
void |
setLoadDelegate(java.util.function.Function<io.jmix.core.LoadContext<E>,E> delegate)
Sets a function which will be used to load data instead of standard implementation.
|
getCondition, getDataContext, getHints, getParameter, getParameters, getQuery, load, removeParameter, setCondition, setDataContext, setHint, setParameter, setParameters, setQuery
InstanceContainer<E> getContainer()
getContainer
in interface DataLoader
void setContainer(InstanceContainer<E> container)
@Nullable java.lang.Object getEntityId()
void setEntityId(java.lang.Object entityId)
io.jmix.core.FetchPlan getFetchPlan()
void setFetchPlan(io.jmix.core.FetchPlan fetchPlan)
void setFetchPlan(java.lang.String fetchPlanName)
java.lang.IllegalStateException
- if the fetch plan has already been set by setFetchPlan(FetchPlan)
java.util.function.Function<io.jmix.core.LoadContext<E>,E> getLoadDelegate()
void setLoadDelegate(java.util.function.Function<io.jmix.core.LoadContext<E>,E> delegate)
io.jmix.core.common.event.Subscription addPreLoadListener(java.util.function.Consumer<InstanceLoader.PreLoadEvent<E>> listener)
InstanceLoader.PreLoadEvent
.
You can also add an event listener declaratively using a controller method annotated with Subscribe
:
@Subscribe(id = "fooDl", target = Target.DATA_LOADER) private void onFooDlPreLoad(InstanceLoader.PreLoadEvent<Foo> event) { // handle event here }
listener
- listenerio.jmix.core.common.event.Subscription addPostLoadListener(java.util.function.Consumer<InstanceLoader.PostLoadEvent<E>> listener)
InstanceLoader.PostLoadEvent
.
You can also add an event listener declaratively using a controller method annotated with Subscribe
:
@Subscribe(id = "fooDl", target = Target.DATA_LOADER) private void onFooDlPostLoad(InstanceLoader.PostLoadEvent<Foo> event) { // handle event here }
listener
- listener