APIdia Launch Partner
Top Description Inners Fields Constructors Methods
io.github.spannm.jackcess

public Class IndexBuilder

extends Object
Class Inheritance
Imports
io.github.spannm.jackcess.impl.DatabaseImpl, .IndexData, .IndexImpl, .JetFormat, .TableImpl, .TableUpdater, io.github.spannm.jackcess.util.ToStringBuilder, java.io.IOException, java.util.ArrayList, .Arrays, .HashSet, .List, .Locale, .Set

Builder style class for constructing an Index. See TableBuilder for example usage. Additionally, an Index can be added to an existing Table using the addToTable(Table) method.
See Also
TableBuilder

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
IndexBuilder.Column

Information about a column in this index (name and ordering).

Field Summary

Modifier and TypeField and Description
private final List<IndexBuilder.Column>
columns

the names and orderings of the indexed columns

private byte
flags

additional index flags (UNKNOWN_INDEX_FLAG always seems to be set in access 2000+)

private int
indexNumber

0-based index number

private String
name

name of the new index

public static final String
PRIMARY_KEY_NAME

name typically used by MS Access for the primary key index

private byte
type

the type of the index

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Index
addToTable(Table table)

Adds a new Index to the given Table with the currently configured attributes.

public Index
addToTableDefinition(TableDefinition table)

Adds a new Index to the given TableDefinition with the currently configured attributes.

public List<IndexBuilder.Column>
public byte
public int
public String
public byte
public boolean
public boolean
public boolean
public void
setIndexNumber(int newIndexNumber)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
validate(Set<String> tableColNames, JetFormat format)

Checks that this index definition is valid.

public IndexBuilder
withColumns(String... names)

Adds the columns with ASCENDING ordering to the index.

public IndexBuilder
withColumns(boolean ascending, String... names)

Adds the columns with the given ordering to the index.

public IndexBuilder
public IndexBuilder
withColumns(boolean ascending, Iterable<String> names)

private String
public IndexBuilder
withIgnoreNulls()

Sets this index to ignore null values.

public IndexBuilder
withName(String newName)

Sets the name of the index.

public IndexBuilder
withPrimaryKey()

Sets this index to be a primary key index (additionally sets the index as unique and required).

public IndexBuilder
withRequired()

Sets this index to enforce required.

public IndexBuilder
withType(byte newType)

public IndexBuilder
withUnique()

Sets this index to enforce uniqueness.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

columnsback to summary
private final List<IndexBuilder.Column> columns

the names and orderings of the indexed columns

flagsback to summary
private byte flags

additional index flags (UNKNOWN_INDEX_FLAG always seems to be set in access 2000+)

indexNumberback to summary
private int indexNumber

0-based index number

nameback to summary
private String name

name of the new index

PRIMARY_KEY_NAMEback to summary
public static final String PRIMARY_KEY_NAME

name typically used by MS Access for the primary key index

typeback to summary
private byte type

the type of the index

Constructor Detail

IndexBuilderback to summary
public IndexBuilder(String name)

Method Detail

addToTableback to summary
public Index addToTable(Table table) throws IOException

Adds a new Index to the given Table with the currently configured attributes.

addToTableDefinitionback to summary
public Index addToTableDefinition(TableDefinition table) throws IOException

Adds a new Index to the given TableDefinition with the currently configured attributes.

getColumnsback to summary
public List<IndexBuilder.Column> getColumns()
getFlagsback to summary
public byte getFlags()
getIndexNumberback to summary
public int getIndexNumber()
getNameback to summary
public String getName()
getTypeback to summary
public byte getType()
isIgnoreNullsback to summary
public boolean isIgnoreNulls()
isPrimaryKeyback to summary
public boolean isPrimaryKey()
isUniqueback to summary
public boolean isUnique()
setIndexNumberback to summary
public void setIndexNumber(int newIndexNumber)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
validateback to summary
public void validate(Set<String> tableColNames, JetFormat format)

Checks that this index definition is valid.

Exceptions
IllegalArgumentException:
if this index definition is invalid.
withColumnsback to summary
public IndexBuilder withColumns(String... names)

Adds the columns with ASCENDING ordering to the index.

withColumnsback to summary
public IndexBuilder withColumns(boolean ascending, String... names)

Adds the columns with the given ordering to the index.

withColumnsback to summary
public IndexBuilder withColumns(Iterable<String> names)
withColumnsback to summary
public IndexBuilder withColumns(boolean ascending, Iterable<String> names)
withErrorContextback to summary
private String withErrorContext(String msg)
withIgnoreNullsback to summary
public IndexBuilder withIgnoreNulls()

Sets this index to ignore null values.

withNameback to summary
public IndexBuilder withName(String newName)

Sets the name of the index.

withPrimaryKeyback to summary
public IndexBuilder withPrimaryKey()

Sets this index to be a primary key index (additionally sets the index as unique and required).

withRequiredback to summary
public IndexBuilder withRequired()

Sets this index to enforce required.

withTypeback to summary
public IndexBuilder withType(byte newType)
withUniqueback to summary
public IndexBuilder withUnique()

Sets this index to enforce uniqueness.

io.github.spannm.jackcess back to summary

public final Class IndexBuilder.Column

extends Object
Class Inheritance

Information about a column in this index (name and ordering).

Field Summary

Modifier and TypeField and Description
private final byte
flags

column flags (ordering)

private String
name

name of the column to be indexed

Constructor Summary

AccessConstructor and Description
private
Column(String name, boolean ascending)

Method Summary

Modifier and TypeMethod and Description
public byte
public String
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public IndexBuilder.Column
withName(String newName)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

flagsback to summary
private final byte flags

column flags (ordering)

nameback to summary
private String name

name of the column to be indexed

Constructor Detail

Columnback to summary
private Column(String name, boolean ascending)

Method Detail

getFlagsback to summary
public byte getFlags()
getNameback to summary
public String getName()
isAscendingback to summary
public boolean isAscending()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
withNameback to summary
public IndexBuilder.Column withName(String newName)