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, RESTORE_DEFAULT_PREFERENCES, USER_PREFERENCES -
Constructor Summary
ConstructorsConstructorDescriptionDefaultEntityApplicationModel(EntityConnectionProvider connectionProvider, Collection<? extends M> entityModels) Instantiates a new DefaultEntityApplicationModelDefaultEntityApplicationModel(EntityConnectionProvider connectionProvider, Collection<? extends M> entityModels, @Nullable Version version) 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 Preferencesfinal Useruser()version()
-
Constructor Details
-
DefaultEntityApplicationModel
public DefaultEntityApplicationModel(EntityConnectionProvider connectionProvider, Collection<? extends M> entityModels) Instantiates a new DefaultEntityApplicationModel- Parameters:
connectionProvider- the EntityConnectionProvider instanceentityModels- the entity models- Throws:
NullPointerException- in case connectionProvider is null
-
DefaultEntityApplicationModel
public DefaultEntityApplicationModel(EntityConnectionProvider connectionProvider, Collection<? extends M> entityModels, @Nullable Version version) Instantiates a new DefaultEntityApplicationModel- Parameters:
connectionProvider- the EntityConnectionProvider instanceentityModels- the entity modelsversion- the application version- 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
-
version
- Specified by:
versionin interfaceEntityApplicationModel<M extends EntityModel<M,E, T>, E extends EntityEditModel, T extends EntityTableModel<E>> - Returns:
- the application version, an empty Optional in case no version information is available
-
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
- Specified by:
preferencesin interfaceEntityApplicationModel<M extends EntityModel<M,E, T>, E extends EntityEditModel, T extends EntityTableModel<E>> - Returns:
- the application preferences instance
- See Also:
-