Module is.codion.framework.model
Package is.codion.framework.model
Class AbstractEntityModel<M extends EntityModel<M,E,T,R>,E extends EntityEditModel<R>,T extends EntityTableModel<E,R>,R extends EntityEditor<R>>
java.lang.Object
is.codion.framework.model.AbstractEntityModel<M,E,T,R>
- Type Parameters:
M- theEntityModeltypeE- theEntityEditModeltypeT- theEntityTableModeltypeR- theEntityEditortype
- All Implemented Interfaces:
EntityModel<M,E, T, R>
- Direct Known Subclasses:
SwingEntityModel
public abstract class AbstractEntityModel<M extends EntityModel<M,E,T,R>,E extends EntityEditModel<R>,T extends EntityTableModel<E,R>,R extends EntityEditor<R>>
extends Object
implements EntityModel<M,E,T,R>
An abstract
EntityModel implementation.-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.framework.model.EntityModel
EntityModel.DetailModels<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractEntityModel(E editModel) Instantiates a newAbstractEntityModel, without a table modelprotectedAbstractEntityModel(T tableModel) Instantiates a newAbstractEntityModel -
Method Summary
Modifier and TypeMethodDescriptionfinal EntityConnectionTypically the single self-managing connection shared by all models of an application, safe to hold on to and use for its lifetime, seeEntityApplicationModel.connection().final booleanfinal EntityModel.DetailModels<M, E, T, R> detail()final Efinal Reditor()final Entitiesentities()final EntityDefinitionfinal EntityTypeThe key identifying this model's node when persisting preferences, defaults to the entity type name.voidrestore(Preferences preferences) Restores the model-owned persistent state of this model and its detail models from the given preferences node.voidstore(Preferences preferences) Stores the model-owned persistent state of this model and its detail models to the given preferences node.final Tfinal StringtoString()
-
Constructor Details
-
AbstractEntityModel
Instantiates a newAbstractEntityModel, without a table model- Parameters:
editModel- the edit model
-
AbstractEntityModel
Instantiates a newAbstractEntityModel- Parameters:
tableModel- the table model
-
-
Method Details
-
toString
-
entityType
- Specified by:
entityTypein interfaceEntityModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> - Returns:
- the type of the entity this entity model is based on
-
connection
Description copied from interface:EntityModelTypically the single self-managing connection shared by all models of an application, safe to hold on to and use for its lifetime, see
EntityApplicationModel.connection().- Specified by:
connectionin interfaceEntityModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> - Returns:
- the connection used by this entity model
-
entities
- Specified by:
entitiesin interfaceEntityModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> - Returns:
- the underlying domain entities
-
entityDefinition
- Specified by:
entityDefinitionin interfaceEntityModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> - Returns:
- the definition of the underlying entity
-
editModel
- Specified by:
editModelin interfaceEntityModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> - Returns:
- the
EntityEditModelinstance used by thisEntityModel
-
editor
- Specified by:
editorin interfaceEntityModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> - Returns:
- the
EntityEditorinstance used by thisEntityModel
-
tableModel
- Specified by:
tableModelin interfaceEntityModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> - Returns:
- the
EntityTableModel
-
containsTableModel
public final boolean containsTableModel()- Specified by:
containsTableModelin interfaceEntityModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> - Returns:
- true if this
EntityModelcontains aEntityTableModel
-
detail
- Specified by:
detailin interfaceEntityModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> - Returns:
- the detail models
-
preferencesKey
Description copied from interface:EntityModelThe key identifying this model's node when persisting preferences, defaults to the entity type name. Must be unique among sibling models and contain only valid preferences node name characters.- Specified by:
preferencesKeyin interfaceEntityModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> - Returns:
- the preferences key for this model
-
store
Description copied from interface:EntityModelStores the model-owned persistent state of this model and its detail models to the given preferences node. Each model stores its state under a child node named by itsEntityModel.preferencesKey(). May be overridden to persist custom state, in which casesuper.store(preferences)should be called in order to retain the default state.This model's node contains the child nodes
modelanddetails, along withviewfor the UI, so custom state belongs in a child node of its own under it, with another name.- Specified by:
storein interfaceEntityModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> - Parameters:
preferences- the preferences node representing the entity models- See Also:
-
restore
Description copied from interface:EntityModelRestores the model-owned persistent state of this model and its detail models from the given preferences node. Each model restores its state from a child node named by itsEntityModel.preferencesKey().- Specified by:
restorein interfaceEntityModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> - Parameters:
preferences- the preferences node representing the entity models- See Also:
-