Skip to content

Commit

Permalink
Add useful signatures to IndexBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
spannm committed Feb 19, 2024
1 parent 4e7ecf1 commit 1d42955
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/main/java/io/github/spannm/jackcess/IndexBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
import io.github.spannm.jackcess.impl.*;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;

/**
* Builder style class for constructing an {@link Index}. See {@link TableBuilder} for example usage. Additionally, an
Expand Down Expand Up @@ -99,6 +96,14 @@ public IndexBuilder withColumns(String... names) {
* Adds the columns with the given ordering to the index.
*/
public IndexBuilder withColumns(boolean ascending, String... names) {
return names != null ? withColumns(ascending, Arrays.asList(names)) : this;
}

public IndexBuilder withColumns(Iterable<String> names) {
return withColumns(true, names);
}

public IndexBuilder withColumns(boolean ascending, Iterable<String> names) {
if (names != null) {
for (String name : names) {
_columns.add(new Column(name, ascending));
Expand Down Expand Up @@ -130,7 +135,7 @@ public IndexBuilder withUnique() {
}

/**
* Sets this index to encforce required.
* Sets this index to enforce required.
*/
public IndexBuilder withRequired() {
_flags |= IndexData.REQUIRED_INDEX_FLAG;
Expand Down

0 comments on commit 1d42955

Please sign in to comment.