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 gov.nist.secauto.metaschema.core.qname.IEnhancedQName; 9 10 import java.util.List; 11 import java.util.Map; 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 { 20 /** 21 * Retrieve the ordered collection of constraints. 22 * 23 * @return the constraints or an empty list 24 */ 25 @NonNull 26 List<? extends IConstraint> getConstraints(); 27 28 /** 29 * Get the collection of let expressions, if any. 30 * 31 * @return the constraints or an empty list 32 */ 33 @NonNull 34 Map<IEnhancedQName, ILet> getLetExpressions(); 35 36 /** 37 * Get the collection of allowed value constraints, if any. 38 * 39 * @return the constraints or an empty list 40 */ 41 @NonNull 42 List<? extends IAllowedValuesConstraint> getAllowedValuesConstraints(); 43 44 /** 45 * Get the collection of matches constraints, if any. 46 * 47 * @return the constraints or an empty list 48 */ 49 @NonNull 50 List<? extends IMatchesConstraint> getMatchesConstraints(); 51 52 /** 53 * Get the collection of index key reference constraints, if any. 54 * 55 * @return the constraints or an empty list 56 */ 57 @NonNull 58 List<? extends IIndexHasKeyConstraint> getIndexHasKeyConstraints(); 59 60 /** 61 * Get the collection of expect constraints, if any. 62 * 63 * @return the constraints or an empty list 64 */ 65 @NonNull 66 List<? extends IExpectConstraint> getExpectConstraints(); 67 68 /** 69 * Add a new let expression. 70 * 71 * @param let 72 * the let statement to add 73 * @return the original let with the same name or {@code null} if no let existed 74 * with the same name 75 */ 76 ILet addLetExpression(@NonNull ILet let); 77 78 /** 79 * Add a new constraint. 80 * 81 * @param constraint 82 * the constraint to add 83 */ 84 void addConstraint(@NonNull IAllowedValuesConstraint constraint); 85 86 /** 87 * Add a new constraint. 88 * 89 * @param constraint 90 * the constraint to add 91 */ 92 void addConstraint(@NonNull IMatchesConstraint constraint); 93 94 /** 95 * Add a new constraint. 96 * 97 * @param constraint 98 * the constraint to add 99 */ 100 void addConstraint(@NonNull IIndexHasKeyConstraint constraint); 101 102 /** 103 * Add a new constraint. 104 * 105 * @param constraint 106 * the constraint to add 107 */ 108 void addConstraint(@NonNull IExpectConstraint constraint); 109 }