1 /* 2 * SPDX-FileCopyrightText: none 3 * SPDX-License-Identifier: CC0-1.0 4 */ 5 6 package gov.nist.secauto.metaschema.core.model.constraint; 7 8 import java.util.List; 9 import java.util.Map; 10 11 import javax.xml.namespace.QName; 12 13 import edu.umd.cs.findbugs.annotations.NonNull; 14 15 /** 16 * Represents a container of rules constraining the effective model of a 17 * Metaschema field or flag data instance. 18 */ 19 public interface IValueConstrained extends IConstrained { 20 /** 21 * Get the collection of let expressions, if any. 22 * 23 * @return the constraints or an empty list 24 */ 25 @NonNull 26 Map<QName, ILet> getLetExpressions(); 27 28 /** 29 * Get the collection of allowed value constraints, if any. 30 * 31 * @return the constraints or an empty list 32 */ 33 @NonNull 34 List<? extends IAllowedValuesConstraint> getAllowedValuesConstraints(); 35 36 /** 37 * Get the collection of matches constraints, if any. 38 * 39 * @return the constraints or an empty list 40 */ 41 @NonNull 42 List<? extends IMatchesConstraint> getMatchesConstraints(); 43 44 /** 45 * Get the collection of index key reference constraints, if any. 46 * 47 * @return the constraints or an empty list 48 */ 49 @NonNull 50 List<? extends IIndexHasKeyConstraint> getIndexHasKeyConstraints(); 51 52 /** 53 * Get the collection of expect constraints, if any. 54 * 55 * @return the constraints or an empty list 56 */ 57 @NonNull 58 List<? extends IExpectConstraint> getExpectConstraints(); 59 60 /** 61 * Add a new let expression. 62 * 63 * @param let 64 * the let statement to add 65 * @return the original let with the same name or {@code null} if no let existed 66 * with the same name 67 */ 68 ILet addLetExpression(@NonNull ILet let); 69 70 /** 71 * Add a new constraint. 72 * 73 * @param constraint 74 * the constraint to add 75 */ 76 void addConstraint(@NonNull IAllowedValuesConstraint constraint); 77 78 /** 79 * Add a new constraint. 80 * 81 * @param constraint 82 * the constraint to add 83 */ 84 void addConstraint(@NonNull IMatchesConstraint constraint); 85 86 /** 87 * Add a new constraint. 88 * 89 * @param constraint 90 * the constraint to add 91 */ 92 void addConstraint(@NonNull IIndexHasKeyConstraint constraint); 93 94 /** 95 * Add a new constraint. 96 * 97 * @param constraint 98 * the constraint to add 99 */ 100 void addConstraint(@NonNull IExpectConstraint constraint); 101 }