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.datatype.markup.MarkupLine;
9 import gov.nist.secauto.metaschema.core.model.constraint.impl.DefaultAllowedValue;
10
11 import edu.umd.cs.findbugs.annotations.NonNull;
12
13 /**
14 * Represents an individual enumerated value associated with an
15 * {@link IAllowedValuesConstraint}.
16 */
17 public interface IAllowedValue {
18 /**
19 * Construct a new allowed value entry for use in an
20 * {@link IAllowedValuesConstraint}.
21 *
22 * @param value
23 * the allowed value
24 * @param description
25 * a textual description of the value
26 * @return the new allowed value
27 */
28 @SuppressWarnings("PMD.ShortMethodName")
29 @NonNull
30 static IAllowedValue of(
31 @NonNull String value,
32 @NonNull MarkupLine description) {
33 // TODO: add support for deprecated version
34 return new DefaultAllowedValue(value, description, null);
35 }
36
37 /**
38 * Retrieves the enumerated value associated with this allowed value constraint
39 * entry.
40 *
41 * @return the value
42 */
43 @NonNull
44 String getValue();
45
46 /**
47 * If the value is deprecated, get the deprecated version.
48 *
49 * @return the deprecated version or {@code null} if the value is not deprecated
50 */
51 String getDeprecatedVersion();
52
53 /**
54 * Retrieves the enumerated value's description associated with this allowed
55 * value constraint entry.
56 *
57 * @return the description
58 */
59 @NonNull
60 MarkupLine getDescription();
61 }