Module is.codion.framework.model
Package is.codion.framework.model
Class DefaultEntityApplicationModel<M extends EntityModel<M,E,T>,E extends EntityEditModel,T extends EntityTableModel<E>>
java.lang.Object
is.codion.framework.model.DefaultEntityApplicationModel<M,E,T>
- Type Parameters:
M- the type ofEntityModelthis application model is based onE- the type ofEntityEditModelused by thisEntityModelT- the type ofEntityTableModelused by thisEntityModel
- All Implemented Interfaces:
EntityApplicationModel<M,E, T>
- Direct Known Subclasses:
SwingEntityApplicationModel
public class DefaultEntityApplicationModel<M extends EntityModel<M,E,T>,E extends EntityEditModel,T extends EntityTableModel<E>>
extends Object
implements EntityApplicationModel<M,E,T>
A central application model class.
-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.framework.model.EntityApplicationModel
EntityApplicationModel.EntityModels<M extends EntityModel<M,E, T>, E extends EntityEditModel, T extends EntityTableModel<E>> -
Field Summary
Fields inherited from interface is.codion.framework.model.EntityApplicationModel
PREFERENCES_KEY, USER_PREFERENCES -
Constructor Summary
ConstructorsConstructorDescriptionDefaultEntityApplicationModel(EntityConnectionProvider connectionProvider, Collection<? extends M> entityModels) Instantiates a new DefaultEntityApplicationModel, using the default file based preferences.DefaultEntityApplicationModel(EntityConnectionProvider connectionProvider, Collection<? extends M> entityModels, Preferences preferences) Instantiates a new DefaultEntityApplicationModel -
Method Summary
Modifier and TypeMethodDescriptionfinal EntityConnectionDo not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.final EntityConnectionProviderfinal Entitiesentities()final EntityApplicationModel.EntityModels<M, E, T> final PreferencesReturns file-based preferences using the domain name as identifier orEntityApplicationModel.PREFERENCES_KEYif specified.final Useruser()
-
Constructor Details
-
DefaultEntityApplicationModel
public DefaultEntityApplicationModel(EntityConnectionProvider connectionProvider, Collection<? extends M> entityModels) Instantiates a new DefaultEntityApplicationModel, using the default file based preferences.- Parameters:
connectionProvider- the EntityConnectionProvider instanceentityModels- the entity models- Throws:
NullPointerException- in case connectionProvider is null
-
DefaultEntityApplicationModel
public DefaultEntityApplicationModel(EntityConnectionProvider connectionProvider, Collection<? extends M> entityModels, Preferences preferences) Instantiates a new DefaultEntityApplicationModel- Parameters:
connectionProvider- the EntityConnectionProvider instanceentityModels- the entity modelspreferences- thePreferencesinstance to use- Throws:
NullPointerException- in case connectionProvider is null
-
-
Method Details
-
user
- Specified by:
userin interfaceEntityApplicationModel<M extends EntityModel<M,E, T>, E extends EntityEditModel, T extends EntityTableModel<E>> - Returns:
- the current user
-
connectionProvider
- Specified by:
connectionProviderin interfaceEntityApplicationModel<M extends EntityModel<M,E, T>, E extends EntityEditModel, T extends EntityTableModel<E>> - Returns:
- the EntityConnectionProvider instance being used by this EntityApplicationModel
-
connection
Description copied from interface:EntityApplicationModelDo not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.- Specified by:
connectionin interfaceEntityApplicationModel<M extends EntityModel<M,E, T>, E extends EntityEditModel, T extends EntityTableModel<E>> - Returns:
- the connection used by this application model
-
entities
- Specified by:
entitiesin interfaceEntityApplicationModel<M extends EntityModel<M,E, T>, E extends EntityEditModel, T extends EntityTableModel<E>> - Returns:
- the underlying domain entities
-
entityModels
- Specified by:
entityModelsin interfaceEntityApplicationModel<M extends EntityModel<M,E, T>, E extends EntityEditModel, T extends EntityTableModel<E>> - Returns:
- the
EntityApplicationModel.EntityModels
-
preferences
Description copied from interface:EntityApplicationModelReturns file-based preferences using the domain name as identifier orEntityApplicationModel.PREFERENCES_KEYif specified. This is used for the hierarchical JSON preferences format.- Specified by:
preferencesin interfaceEntityApplicationModel<M extends EntityModel<M,E, T>, E extends EntityEditModel, T extends EntityTableModel<E>> - Returns:
- the application preferences instance
- See Also:
-