Class TableDefinition.Builder

java.lang.Object
org.apache.ignite.catalog.definitions.TableDefinition.Builder
Enclosing class:
TableDefinition

public static class TableDefinition.Builder extends Object
Builder for the table definition.
  • Method Details

    • schema

      public TableDefinition.Builder schema(String schemaName)
      Sets schema name.
      Parameters:
      schemaName - Schema name.
      Returns:
      This builder instance.
    • ifNotExists

      public TableDefinition.Builder ifNotExists()
      Sets not exists flag.
      Returns:
      This builder instance.
    • columns

      public TableDefinition.Builder columns(ColumnDefinition... columns)
      Sets definitions of the columns.
      Parameters:
      columns - An array of column definitions.
      Returns:
      This builder instance.
    • columns

      public TableDefinition.Builder columns(List<ColumnDefinition> columns)
      Sets definitions of the columns.
      Parameters:
      columns - A list of column definitions.
      Returns:
      This builder instance.
    • colocateBy

      public TableDefinition.Builder colocateBy(String... colocationColumns)
      Sets colocation columns.
      Parameters:
      colocationColumns - An array of colocation column names.
      Returns:
      This builder instance.
    • colocateBy

      public TableDefinition.Builder colocateBy(List<String> colocationColumns)
      Sets colocation columns.
      Parameters:
      colocationColumns - An array of colocation column names.
      Returns:
      This builder instance.
    • zone

      public TableDefinition.Builder zone(String zoneName)
      Sets primary zone name.
      Parameters:
      zoneName - Primary zone name.
      Returns:
      This builder instance.
    • key

      public TableDefinition.Builder key(Class<?> keyClass)
      Sets key class to generate columns. If it's a natively supported class, then the column with the name "id" will be created and added to the list of columns for the primary key. If it's annotated with the Table annotation, then the annotation will be processed and column definitions will be extracted from it.
      Parameters:
      keyClass - Record class.
      Returns:
      This builder instance.
    • value

      public TableDefinition.Builder value(Class<?> valueClass)
      Sets value class to generate columns. If it's a natively supported class, then the column with the name "val" will be created. If it's annotated with the Table annotation, then the annotation will be processed and column definitions will be extracted from it.
      Parameters:
      valueClass - Value class.
      Returns:
      This builder instance.
    • record

      public TableDefinition.Builder record(Class<?> recordClass)
      Sets record class to generate columns. If it's a natively supported class, then the column with the name "id" will be created and added to the list of columns for the primary key. If it's annotated with the Table annotation, then the annotation will be processed and column definitions will be extracted from it.
      Parameters:
      recordClass - Record class.
      Returns:
      This builder instance.
    • primaryKey

      public TableDefinition.Builder primaryKey(String... columnNames)
      Sets primary key columns using default index type.
      Parameters:
      columnNames - Column names to use in the primary key.
      Returns:
      This builder instance.
    • primaryKey

      public TableDefinition.Builder primaryKey(IndexType type, ColumnSorted... columns)
      Sets primary key columns.
      Parameters:
      type - Type of the index.
      columns - An array of columns to use in the primary key.
      Returns:
      This builder instance.
    • primaryKey

      public TableDefinition.Builder primaryKey(IndexType type, List<ColumnSorted> columns)
      Sets primary key columns.
      Parameters:
      type - Type of the index.
      columns - A list of columns to use in the primary key.
      Returns:
      This builder instance.
    • index

      public TableDefinition.Builder index(String... columnNames)
      Adds an index on this table using specified columns and default index type and sort order. The name of the index will be autogenerated from the column names.
      Parameters:
      columnNames - An array of column names to use to create index.
      Returns:
      This builder instance.
    • index

      public TableDefinition.Builder index(@Nullable @Nullable String indexName, IndexType type, ColumnSorted... columns)
      Adds an index on this table using specified columns with sort order and index type.
      Parameters:
      indexName - Name of the index or null to autogenerate the name.
      type - Index type.
      columns - An array of columns to use to create index.
      Returns:
      This builder instance.
    • index

      public TableDefinition.Builder index(@Nullable @Nullable String indexName, IndexType type, List<ColumnSorted> columns)
      Adds an index on this table using specified columns with sort order and index type.
      Parameters:
      indexName - Name of the index or null to autogenerate the name.
      type - Index type.
      columns - A list of columns to use to create index.
      Returns:
      This builder instance.
    • build

      public TableDefinition build()
      Builds the table definition.
      Returns:
      Table definition.