Class TableBuilder


  • public class TableBuilder
    extends Object
    Builder style class for constructing a Table.

    Example:

       Table table = new TableBuilder("Test")
         .addColumn(new ColumnBuilder("ID", DataType.LONG)
                    .setAutoNumber(true))
         .addColumn(new ColumnBuilder("Name", DataType.TEXT))
         .addIndex(new IndexBuilder(IndexBuilder.PRIMARY_KEY_NAME)
                   .addColumns("ID").setPrimaryKey())
         .toTable(db);
    Author:
    James Ahlborn
    See Also:
    ColumnBuilder, IndexBuilder, RelationshipBuilder
    Usage:
    General: This class is general use.
    • Constructor Detail

      • TableBuilder

        public TableBuilder​(String name)
      • TableBuilder

        public TableBuilder​(String name,
                            boolean escapeIdentifiers)
    • Method Detail

      • getName

        public String getName()
      • setEscapeIdentifiers

        public TableBuilder setEscapeIdentifiers​(boolean escapeIdentifiers)
        Sets whether or not subsequently added columns will have their names automatically escaped
      • setPrimaryKey

        public TableBuilder setPrimaryKey​(String... colNames)
        Sets the names of the primary key columns for this table. Convenience method for creating a primary key index on a table.
      • putProperty

        public TableBuilder putProperty​(String name,
                                        Object value)
        Sets the table property with the given name to the given value. Attempts to determine the type of the property (see PropertyMap.put(String,Object) for details on determining the property type).
      • putProperty

        public TableBuilder putProperty​(String name,
                                        DataType type,
                                        Object value)
        Sets the table property with the given name and type to the given value.
      • escapeIdentifier

        public static String escapeIdentifier​(String s)
        Returns:
        A table or column name escaped for Access
        Usage:
        General: This method is general use.
      • isReservedWord

        public static boolean isReservedWord​(String s)
        Returns:
        true if the given string is a reserved word, false otherwise
        Usage:
        General: This method is general use.