1
2
3
4
5
6 package gov.nist.secauto.metaschema.core.model.constraint;
7
8 import gov.nist.secauto.metaschema.core.model.constraint.impl.DefaultUniqueConstraint;
9 import gov.nist.secauto.metaschema.core.util.ObjectUtils;
10
11 import edu.umd.cs.findbugs.annotations.NonNull;
12
13
14
15
16
17
18
19
20 public interface IUniqueConstraint extends IKeyConstraint {
21
22 @Override
23 default <T, R> R accept(IConstraintVisitor<T, R> visitor, T state) {
24 return visitor.visitUniqueConstraint(this, state);
25 }
26
27
28
29
30
31
32 @NonNull
33 static Builder builder() {
34 return new Builder();
35 }
36
37 final class Builder
38 extends AbstractKeyConstraintBuilder<Builder, IUniqueConstraint> {
39 private Builder() {
40
41 }
42
43 @Override
44 protected Builder getThis() {
45 return this;
46 }
47
48 @Override
49 protected IUniqueConstraint newInstance() {
50 return new DefaultUniqueConstraint(
51 getId(),
52 getFormalName(),
53 getDescription(),
54 ObjectUtils.notNull(getSource()),
55 getLevel(),
56 getTarget(),
57 getProperties(),
58 getKeyFields(),
59 getRemarks());
60 }
61 }
62 }