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 - the EntityModel type
E - the EntityEditModel type
T - the EntityTableModel type
R - the EntityEditor type
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.
  • Method Details

    • entityType

      EntityType entityType()
      Returns:
      the type of the entity this entity model is based on
    • connection

      EntityConnection connection()

      Typically 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().

      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 EntityEditModel instance used by this EntityModel
    • editor

      R editor()
      Returns:
      the EntityEditor instance used by this EntityModel
    • tableModel

      T tableModel()
      Returns:
      the EntityTableModel
      Throws:
      IllegalStateException - in case no table model is available
    • containsTableModel

      boolean containsTableModel()
      Returns:
      true if this EntityModel contains a EntityTableModel
    • detail

      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

      void store(Preferences preferences)
      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 its preferencesKey(). May be overridden to persist custom state, in which case super.store(preferences) should be called in order to retain the default state.
      Parameters:
      preferences - the preferences node representing the entity models
      See Also:
    • restore

      void restore(Preferences preferences)
      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 its preferencesKey().
      Parameters:
      preferences - the preferences node representing the entity models
      See Also: