Class TableEditorImpl

    • Constructor Detail

      • TableEditorImpl

        protected TableEditorImpl()
    • Method Detail

      • tableId

        public TableId tableId()
        Description copied from interface: TableEditor
        Get the identifier for this table.
        Specified by:
        tableId in interface TableEditor
        Returns:
        the table identifier; may be null if not set
      • tableId

        public TableEditor tableId​(TableId id)
        Description copied from interface: TableEditor
        Set the table identifier.
        Specified by:
        tableId in interface TableEditor
        Parameters:
        id - the table identifier
        Returns:
        this editor so callers can chain methods together
      • columnWithName

        public Column columnWithName​(String name)
        Description copied from interface: TableEditor
        Get the definition for the column in this table with the supplied name. The case of the supplied name does not matter.
        Specified by:
        columnWithName in interface TableEditor
        Parameters:
        name - the case-insensitive name of the column
        Returns:
        the column definition, or null if there is no column with the given name
      • hasColumnWithName

        protected boolean hasColumnWithName​(String name)
      • primaryKeyColumnNames

        public List<String> primaryKeyColumnNames()
        Description copied from interface: TableEditor
        The list of column names that make up the primary key for this table. The resulting list should not be modified directly; instead, the set of primary key names should be defined with TableEditor.setPrimaryKeyNames(String...).
        Specified by:
        primaryKeyColumnNames in interface TableEditor
        Returns:
        the list of column names that make up the primary key; never null but possibly empty
      • addColumns

        public TableEditor addColumns​(Column... columns)
        Description copied from interface: TableEditor
        Add one or more columns to this table, regardless of the position of the supplied columns. However, if an existing column definition matches a supplied column, the new column definition will replace the existing column definition.
        Specified by:
        addColumns in interface TableEditor
        Parameters:
        columns - the definitions for the columns to be added
        Returns:
        this editor so callers can chain methods together
      • addColumns

        public TableEditor addColumns​(Iterable<Column> columns)
        Description copied from interface: TableEditor
        Add one or more columns to the end of this table's list of columns, regardless of the position of the supplied columns. However, if an existing column definition matches a supplied column, the new column definition will replace the existing column definition.
        Specified by:
        addColumns in interface TableEditor
        Parameters:
        columns - the definitions for the columns to be added
        Returns:
        this editor so callers can chain methods together
      • add

        protected void add​(Column defn)
      • setColumns

        public TableEditor setColumns​(Column... columns)
        Description copied from interface: TableEditor
        Set this table's column definitions. The table's primary key columns may be removed as a result of this method if they refer to columns that are not in the supplied list of column definitions.
        Specified by:
        setColumns in interface TableEditor
        Parameters:
        columns - the definitions for the columns to be added
        Returns:
        this editor so callers can chain methods together
      • setColumns

        public TableEditor setColumns​(Iterable<Column> columns)
        Description copied from interface: TableEditor
        Set this table's column definitions. The table's primary key columns may be removed as a result of this method if they refer to columns that are not in the supplied list of column definitions.
        Specified by:
        setColumns in interface TableEditor
        Parameters:
        columns - the definitions for the columns to be added
        Returns:
        this editor so callers can chain methods together
      • updatePrimaryKeys

        protected void updatePrimaryKeys()
      • setPrimaryKeyNames

        public TableEditor setPrimaryKeyNames​(String... pkColumnNames)
        Description copied from interface: TableEditor
        Set the columns that make up this table's primary key.
        Specified by:
        setPrimaryKeyNames in interface TableEditor
        Parameters:
        pkColumnNames - the names of this tables columns that make up the primary key
        Returns:
        this editor so callers can chain methods together
      • setPrimaryKeyNames

        public TableEditor setPrimaryKeyNames​(List<String> pkColumnNames)
        Description copied from interface: TableEditor
        Set the columns that make up this table's primary key.
        Specified by:
        setPrimaryKeyNames in interface TableEditor
        Parameters:
        pkColumnNames - the names of this tables columns that make up the primary key
        Returns:
        this editor so callers can chain methods together
      • setUniqueValues

        public TableEditor setUniqueValues()
        Description copied from interface: TableEditor
        Sets this table's primary key to contain all columns, ensuring that all values are unique within the table. This is analogous to calling setPrimaryKeyNames(columnNames()) except that the primary key is updated when columns are added or removed.
        Specified by:
        setUniqueValues in interface TableEditor
        Returns:
        this editor so callers can chain methods together
      • setDefaultCharsetName

        public TableEditor setDefaultCharsetName​(String charsetName)
        Description copied from interface: TableEditor
        Set the name of the character set that should be used by default in the columns that require a character set but have not defined one.
        Specified by:
        setDefaultCharsetName in interface TableEditor
        Parameters:
        charsetName - the name of the character set that should be used by default
        Returns:
        this editor so callers can chain methods together
      • setComment

        public TableEditor setComment​(String comment)
        Description copied from interface: TableEditor
        Set the comment of the table
        Specified by:
        setComment in interface TableEditor
        Parameters:
        comment - table comment
        Returns:
        this editor so callers can chain methods together
      • hasDefaultCharsetName

        public boolean hasDefaultCharsetName()
        Description copied from interface: TableEditor
        Determine if a default character set has been set on this table.
        Specified by:
        hasDefaultCharsetName in interface TableEditor
        Returns:
        true if this has a default character set, or false if one has not yet been set
      • hasComment

        public boolean hasComment()
        Description copied from interface: TableEditor
        Determine if a comment has been set on this table.
        Specified by:
        hasComment in interface TableEditor
        Returns:
        true if this has a comment, or false if one has not yet been set
      • removeColumn

        public TableEditor removeColumn​(String columnName)
        Description copied from interface: TableEditor
        Remove the column with the given name. This method does nothing if no such column exists.
        Specified by:
        removeColumn in interface TableEditor
        Parameters:
        columnName - the name of the column to be removed
        Returns:
        this editor so callers can chain methods together
      • updateColumn

        public TableEditor updateColumn​(Column newColumn)
        Description copied from interface: TableEditor
        Update the column with the given name. The existing column definition with the name as the column provided is replaced with the new one.
        Specified by:
        updateColumn in interface TableEditor
        Parameters:
        newColumn - the new column definition
        Returns:
        this editor so callers can chain methods together
      • reorderColumn

        public TableEditor reorderColumn​(String columnName,
                                         String afterColumnName)
        Description copied from interface: TableEditor
        Reorder the column with the given name to be positioned after the designated column. If afterColumnName is null, the column will be moved to the first column.
        Specified by:
        reorderColumn in interface TableEditor
        Parameters:
        columnName - the name of the column to be removed
        afterColumnName - the name of the column after which the moved column is to be positioned; may be null if the column is to be moved to the first column
        Returns:
        this editor so callers can chain methods together
      • renameColumn

        public TableEditor renameColumn​(String existingName,
                                        String newName)
        Description copied from interface: TableEditor
        Rename the column with the given name to the new specified name.
        Specified by:
        renameColumn in interface TableEditor
        Parameters:
        existingName - the existing name of the column to be renamed; may not be null
        newName - the new name of the column; may not be null
        Returns:
        this editor so callers can chain methods together
      • updatePositions

        protected void updatePositions()
      • positionsAreValid

        protected boolean positionsAreValid()
      • create

        public Table create()
        Description copied from interface: TableEditor
        Obtain an immutable table definition representing the current state of this editor. This editor can be reused after this method, since the resulting table definition no longer refers to any of the data used in this editor.
        Specified by:
        create in interface TableEditor
        Returns:
        the immutable table definition; never null