Module storm

Interface Model<E extends Record,ID>

Type Parameters:
E - the type of the entity or projection.
ID - the type of the primary key, or Void in case of a projection without a primary key.
All Known Implementing Classes:
ModelImpl

public interface Model<E extends Record,ID>
Represents the model of an entity or projection.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns an immutable list of columns in the entity or projection.
    getValue(Column column, E record)
    Extracts the value for the specified column from the given record.
    getValues(E record)
    Extracts the values from the given record and maps them to the columns of the entity or projection.
    boolean
    Returns {code true} if the specified primary key represents a default value, false otherwise.
    Returns the name of the table or view.
    Returns the type of the primary key.
    Returns the qualified name of the table or view, including the schema and escape characters where necessary.
    Returns the schema, or an empty String if the schema is not specified.
    Returns the type of the entity or projection.
  • Method Details

    • schema

      String schema()
      Returns the schema, or an empty String if the schema is not specified.
      Returns:
      the schema, or an empty String if the schema is not specified.
    • name

      String name()
      Returns the name of the table or view.
      Returns:
      the name of the table or view.
    • qualifiedName

      String qualifiedName(@Nonnull SqlDialect dialect)
      Returns the qualified name of the table or view, including the schema and escape characters where necessary.
      Returns:
      the qualified name of the table or view, including the schema and escape characters where necessary.
    • type

      Class<E> type()
      Returns the type of the entity or projection.
      Returns:
      the type of the entity or projection.
    • primaryKeyType

      Class<ID> primaryKeyType()
      Returns the type of the primary key.
      Returns:
      the type of the primary key.
    • columns

      List<Column> columns()
      Returns an immutable list of columns in the entity or projection.
      Returns:
      an immutable list of columns in the entity or projection.
    • isDefaultPrimaryKey

      boolean isDefaultPrimaryKey(@Nullable ID pk)
      Returns {code true} if the specified primary key represents a default value, false otherwise.

      This method is used to check if the primary key of the entity is a default value. This is useful when determining if the entity is new or has been persisted before.

      Parameters:
      pk - primary key to check.
      Returns:
      {code true} if the specified primary key represents a default value, false otherwise.
      Since:
      1.2
    • getValue

      Object getValue(@Nonnull Column column, @Nonnull E record)
      Extracts the value for the specified column from the given record.
      Parameters:
      column - the column to extract the value for.
      record - the record to extract the value from.
      Returns:
      the value for the specified column from the given record.
      Since:
      1.2
    • getValues

      SequencedMap<Column,Object> getValues(@Nonnull E record)
      Extracts the values from the given record and maps them to the columns of the entity or projection.
      Parameters:
      record - the record to extract the values from.
      Returns:
      the values from the given record mapped to the columns of the entity or projection.
      Since:
      1.2