Interface ReadView<E>

Type Parameters:
E - type of entity
All Known Implementing Classes:
StandardReadView, TemplateReadView

@NullMarked public interface ReadView<E>
Interface of views that display an entity instance without editing it.
  • Method Summary

    Modifier and Type
    Method
    Description
    default E
    Returns the currently shown entity instance.
    @Nullable E
    Returns the currently shown entity instance or null if it isn't loaded yet.
    void
    Sets the entity instance to show.
  • Method Details

    • setEntityToRead

      void setEntityToRead(E entity)
      Sets the entity instance to show. The view reloads the instance by its id, so what is displayed always matches the view's fetch plan.
      Parameters:
      entity - entity instance to show
    • getEntity

      default E getEntity()
      Returns the currently shown entity instance.
      Returns:
      currently shown entity instance
      Throws:
      IllegalStateException - if the entity isn't loaded yet, for example in View.InitEvent
    • getEntityOrNull

      @Nullable E getEntityOrNull()
      Returns the currently shown entity instance or null if it isn't loaded yet.
      Returns:
      currently shown entity instance or null if it isn't loaded yet