public class InstanceContainerImpl<E> extends java.lang.Object implements InstanceContainer<E>, HasLoader, ItemPropertyChangeNotifier
InstanceContainer.ItemChangeEvent<T>, InstanceContainer.ItemPropertyChangeEvent<T>| Modifier and Type | Field and Description |
|---|---|
protected io.jmix.core.metamodel.model.MetaClass |
entityMetaClass |
protected io.jmix.core.common.event.EventHub |
events |
protected io.jmix.core.FetchPlan |
fetchPlan |
protected E |
item |
protected io.jmix.core.entity.EntityPropertyChangeListener |
listener |
protected boolean |
listenersEnabled |
protected DataLoader |
loader |
protected io.jmix.core.Metadata |
metadata |
| Constructor and Description |
|---|
InstanceContainerImpl(io.jmix.core.metamodel.model.MetaClass entityMetaClass) |
| Modifier and Type | Method and Description |
|---|---|
io.jmix.core.common.event.Subscription |
addItemChangeListener(java.util.function.Consumer<InstanceContainer.ItemChangeEvent<E>> listener)
Adds listener to
InstanceContainer.ItemChangeEvents. |
io.jmix.core.common.event.Subscription |
addItemPropertyChangeListener(java.util.function.Consumer<InstanceContainer.ItemPropertyChangeEvent<E>> listener)
Adds listener to
InstanceContainer.ItemPropertyChangeEvents. |
protected void |
attachListener(java.lang.Object entity) |
protected void |
detachListener(java.lang.Object entity) |
protected void |
fireItemChanged(E prevItem) |
io.jmix.core.metamodel.model.MetaClass |
getEntityMetaClass()
Returns the meta-class of entities that can be stored in the container.
|
io.jmix.core.FetchPlan |
getFetchPlan()
Returns the view which was set by previous call to
InstanceContainer.setFetchPlan(FetchPlan). |
E |
getItem()
Returns the contained entity instance.
|
E |
getItemOrNull()
Returns the contained entity instance or null if there is no entity in the container.
|
DataLoader |
getLoader()
Returns the loader of this container.
|
void |
itemPropertyChanged(io.jmix.core.entity.EntityPropertyChangeEvent e) |
void |
mute()
Disables all event listeners on container data change.
|
void |
setFetchPlan(io.jmix.core.FetchPlan fetchPlan)
Sets a view to be used when loading entities for this container.
|
void |
setItem(E item)
Sets the given entity instance to the container.
|
void |
setLoader(DataLoader loader)
Sets the loader for this container.
|
java.lang.String |
toString() |
void |
unmute()
Enables all event listeners.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetView, setView@Autowired protected io.jmix.core.Metadata metadata
protected E item
protected io.jmix.core.metamodel.model.MetaClass entityMetaClass
protected io.jmix.core.FetchPlan fetchPlan
protected io.jmix.core.common.event.EventHub events
protected io.jmix.core.entity.EntityPropertyChangeListener listener
protected DataLoader loader
protected boolean listenersEnabled
public InstanceContainerImpl(io.jmix.core.metamodel.model.MetaClass entityMetaClass)
@Nullable public E getItemOrNull()
InstanceContainergetItemOrNull in interface InstanceContainer<E>public E getItem()
InstanceContainergetItem in interface InstanceContainer<E>public void setItem(@Nullable
E item)
InstanceContainersetItem in interface InstanceContainer<E>public io.jmix.core.metamodel.model.MetaClass getEntityMetaClass()
InstanceContainergetEntityMetaClass in interface InstanceContainer<E>@Nullable public io.jmix.core.FetchPlan getFetchPlan()
InstanceContainerInstanceContainer.setFetchPlan(FetchPlan).
The view is normally used when loading entities for this container.getFetchPlan in interface InstanceContainer<E>public void setFetchPlan(io.jmix.core.FetchPlan fetchPlan)
InstanceContainersetFetchPlan in interface InstanceContainer<E>public io.jmix.core.common.event.Subscription addItemPropertyChangeListener(java.util.function.Consumer<InstanceContainer.ItemPropertyChangeEvent<E>> listener)
InstanceContainerInstanceContainer.ItemPropertyChangeEvents.addItemPropertyChangeListener in interface InstanceContainer<E>public io.jmix.core.common.event.Subscription addItemChangeListener(java.util.function.Consumer<InstanceContainer.ItemChangeEvent<E>> listener)
InstanceContainerInstanceContainer.ItemChangeEvents.addItemChangeListener in interface InstanceContainer<E>protected void attachListener(java.lang.Object entity)
protected void detachListener(java.lang.Object entity)
public java.lang.String toString()
toString in class java.lang.Object@Nullable public DataLoader getLoader()
HasLoaderpublic void setLoader(DataLoader loader)
HasLoaderprotected void fireItemChanged(@Nullable
E prevItem)
public void itemPropertyChanged(io.jmix.core.entity.EntityPropertyChangeEvent e)
itemPropertyChanged in interface ItemPropertyChangeNotifierpublic void mute()
InstanceContainerInstanceContainer.unmute() for bulk data modification as a perfomance optimization.mute in interface InstanceContainer<E>public void unmute()
InstanceContainerunmute in interface InstanceContainer<E>