diff options
-rw-r--r-- | src/main/java/com/healthmarketscience/jackcess/IndexBuilder.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/IndexBuilder.java b/src/main/java/com/healthmarketscience/jackcess/IndexBuilder.java index 88be6c5..9c9f584 100644 --- a/src/main/java/com/healthmarketscience/jackcess/IndexBuilder.java +++ b/src/main/java/com/healthmarketscience/jackcess/IndexBuilder.java @@ -109,10 +109,11 @@ public class IndexBuilder /** * Sets this index to be a primary key index (additionally sets the index as - * unique). + * unique and required). */ public IndexBuilder setPrimaryKey() { _type = IndexImpl.PRIMARY_KEY_INDEX_TYPE; + setRequired(); return setUnique(); } @@ -125,6 +126,14 @@ public class IndexBuilder } /** + * Sets this index to encforce required. + */ + public IndexBuilder setRequired() { + _flags |= IndexData.REQUIRED_INDEX_FLAG; + return this; + } + + /** * Sets this index to ignore null values. */ public IndexBuilder setIgnoreNulls() { |