Enum Class SelectAllQueryGenerator

java.lang.Object
java.lang.Enum<SelectAllQueryGenerator>
dimstyl.orm.internal.sql.generator.SelectAllQueryGenerator
All Implemented Interfaces:
SqlQueryGenerator<Optional<String>,RepositoryMetadata>, Serializable, Comparable<SelectAllQueryGenerator>, Constable

enum SelectAllQueryGenerator extends Enum<SelectAllQueryGenerator> implements SqlQueryGenerator<Optional<String>,RepositoryMetadata>
Generates an SQL `SELECT * FROM` query for retrieving all records from a table.

This generator ensures that the repository supports the `SELECT_ALL` operation before creating the query. If the operation is not supported, query generation is skipped.

  • Enum Constant Details

    • INSTANCE

      public static final SelectAllQueryGenerator INSTANCE
      The singleton instance of the SelectAllQueryGenerator.
  • Constructor Details

    • SelectAllQueryGenerator

      private SelectAllQueryGenerator()
  • Method Details

    • values

      public static SelectAllQueryGenerator[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SelectAllQueryGenerator valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • generate

      public Optional<String> generate(RepositoryMetadata repositoryMetadata)
      Generates an SQL `SELECT * FROM` query if the repository supports the `SELECT_ALL` operation.

      If the repository does not support this operation, query generation is skipped, and an empty Optional is returned.

      Specified by:
      generate in interface SqlQueryGenerator<Optional<String>,RepositoryMetadata>
      Parameters:
      repositoryMetadata - Metadata containing information about the repository, including the table name and supported operations, as defined by RepositoryMetadata.
      Returns:
      An Optional containing the SQL query if the `SELECT_ALL` operation is supported, otherwise an empty Optional.