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
38
39
40 final class Builder
41 extends AbstractKeyConstraintBuilder<Builder, IUniqueConstraint> {
42 private Builder() {
43
44 }
45
46 @Override
47 protected Builder getThis() {
48 return this;
49 }
50
51 @Override
52 protected IUniqueConstraint newInstance() {
53 return new DefaultUniqueConstraint(
54 getId(),
55 getFormalName(),
56 getDescription(),
57 ObjectUtils.notNull(getSource()),
58 getLevel(),
59 getTarget(),
60 getProperties(),
61 getKeyFields(),
62 getMessage(),
63 getRemarks());
64 }
65 }
66 }