public class IndexBuilder extends Object
Index
. See TableBuilder
for example usage. Additionally, an Index can be added to an
existing Table using the addToTable(Table)
method.TableBuilder
Modifier and Type | Class and Description |
---|---|
static class |
IndexBuilder.Column
Information about a column in this index (name and ordering).
|
Modifier and Type | Field and Description |
---|---|
static String |
PRIMARY_KEY_NAME
name typically used by MS Access for the primary key index
|
Constructor and Description |
---|
IndexBuilder(String name) |
Modifier and Type | Method and Description |
---|---|
IndexBuilder |
addColumns(boolean ascending,
String... names)
Adds the columns with the given ordering to the index.
|
IndexBuilder |
addColumns(String... names)
Adds the columns with ASCENDING ordering to the index.
|
Index |
addToTable(Table table)
Adds a new Index to the given Table with the currently configured
attributes.
|
Index |
addToTableDefinition(TableDefinition table)
Adds a new Index to the given TableDefinition with the currently
configured attributes.
|
List<IndexBuilder.Column> |
getColumns() |
byte |
getFlags() |
int |
getIndexNumber() |
String |
getName() |
byte |
getType() |
boolean |
isIgnoreNulls() |
boolean |
isPrimaryKey() |
boolean |
isUnique() |
IndexBuilder |
setIgnoreNulls()
Sets this index to ignore null values.
|
void |
setIndexNumber(int newIndexNumber) |
IndexBuilder |
setName(String name)
Sets the name of the index.
|
IndexBuilder |
setPrimaryKey()
Sets this index to be a primary key index (additionally sets the index as
unique and required).
|
IndexBuilder |
setRequired()
Sets this index to encforce required.
|
IndexBuilder |
setType(byte type) |
IndexBuilder |
setUnique()
Sets this index to enforce uniqueness.
|
void |
validate(Set<String> tableColNames,
JetFormat format)
Checks that this index definition is valid.
|
public static final String PRIMARY_KEY_NAME
public IndexBuilder(String name)
public String getName()
public byte getType()
public byte getFlags()
public boolean isPrimaryKey()
public boolean isUnique()
public boolean isIgnoreNulls()
public List<IndexBuilder.Column> getColumns()
public IndexBuilder setName(String name)
public IndexBuilder addColumns(String... names)
public IndexBuilder addColumns(boolean ascending, String... names)
public IndexBuilder setPrimaryKey()
public IndexBuilder setType(byte type)
public IndexBuilder setUnique()
public IndexBuilder setRequired()
public IndexBuilder setIgnoreNulls()
public int getIndexNumber()
public void setIndexNumber(int newIndexNumber)
public void validate(Set<String> tableColNames, JetFormat format)
IllegalArgumentException
- if this index definition is invalid.public Index addToTable(Table table) throws IOException
IOException
public Index addToTableDefinition(TableDefinition table) throws IOException
IOException
Copyright © 2005–2024 OpenHMS. All rights reserved.