1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package dev.metaschema.core.model.constraint;
7   
8   import java.util.List;
9   
10  import dev.metaschema.core.metapath.IMetapathExpression;
11  import dev.metaschema.core.model.IAssemblyDefinition;
12  import dev.metaschema.core.model.IFieldDefinition;
13  import dev.metaschema.core.model.IFlagDefinition;
14  import edu.umd.cs.findbugs.annotations.NonNull;
15  
16  /**
17   * Represents a set of constraints that target a given definition using a target
18   * Metapath expression.
19   */
20  public interface ITargetedConstraints extends IValueConstrained {
21    /**
22     * Get the Metapath expressions used to identify the targets of the constraint.
23     *
24     * @return the Metapath expressions identifying the targets of the associated
25     *         constraints
26     */
27    @NonNull
28    List<IMetapathExpression> getTargets();
29  
30    /**
31     * Apply the constraint to the provided definition.
32     *
33     * @param definition
34     *          the definition to apply the constraint to
35     */
36    void target(@NonNull IFlagDefinition definition);
37  
38    /**
39     * Apply the constraint to the provided definition.
40     *
41     * @param definition
42     *          the definition to apply the constraint to
43     */
44    void target(@NonNull IFieldDefinition definition);
45  
46    /**
47     * Apply the constraint to the provided definition.
48     *
49     * @param definition
50     *          the definition to apply the constraint to
51     */
52    void target(@NonNull IAssemblyDefinition definition);
53  }