Module is.codion.framework.model
Package is.codion.framework.model
Interface EntityModel<M extends EntityModel<M,E,T,R>,E extends EntityEditModel<R>,T extends EntityTableModel<E,R>,R extends EntityEditor<R>>
- Type Parameters:
M- theEntityModeltypeE- theEntityEditModeltypeT- theEntityTableModeltypeR- theEntityEditortype
- All Known Implementing Classes:
AbstractEntityModel,SwingEntityModel
public interface EntityModel<M extends EntityModel<M,E,T,R>,E extends EntityEditModel<R>,T extends EntityTableModel<E,R>,R extends EntityEditor<R>>
Coordinates, among other things, an
EntityEditModel and an EntityTableModel.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceEntityModel.DetailModels<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<R>, T extends EntityTableModel<E, R>, R extends EntityEditor<R>> Manages the detail models for aEntityModel -
Method Summary
Modifier and TypeMethodDescriptionDo not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.booleandetail()editor()entities()The 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.
-
Method Details
-
entityType
EntityType entityType()- Returns:
- the type of the entity this entity model is based on
-
connectionProvider
EntityConnectionProvider connectionProvider()- Returns:
- the connection provider used by this entity model
-
connection
EntityConnection connection()Do not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.- Returns:
- the connection used by this entity model
-
entities
Entities entities()- Returns:
- the underlying domain entities
-
entityDefinition
EntityDefinition entityDefinition()- Returns:
- the definition of the underlying entity
-
editModel
E editModel()- Returns:
- the
EntityEditModelinstance used by thisEntityModel
-
editor
R editor()- Returns:
- the
EntityEditorinstance used by thisEntityModel
-
tableModel
T tableModel()- Returns:
- the
EntityTableModel - Throws:
IllegalStateException- in case no table model is available
-
containsTableModel
boolean containsTableModel()- Returns:
- true if this
EntityModelcontains aEntityTableModel
-
detail
EntityModel.DetailModels<M,E, detail()T, R> - Returns:
- the detail models
-
preferencesKey
String preferencesKey()The 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.- Returns:
- the preferences key for this model
-
store
Stores 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 itspreferencesKey(). May be overridden to persist custom state, in which casesuper.store(preferences)should be called in order to retain the default state.- Parameters:
preferences- the preferences node representing the entity models- See Also:
-
restore
Restores 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 itspreferencesKey().- Parameters:
preferences- the preferences node representing the entity models- See Also:
-