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 import edu.umd.cs.findbugs.annotations.Nullable;
13
14 /**
15 * Represents an individual enumerated value associated with an
16 * {@link IAllowedValuesConstraint}.
17 * <p>
18 * These values are part of a collection of values in an
19 * {@link IAllowedValuesConstraint}.
20 */
21 public interface IAllowedValue {
22 /**
23 * Construct a new allowed value entry for use in an
24 * {@link IAllowedValuesConstraint}.
25 *
26 * @param value
27 * the allowed value
28 * @param description
29 * a textual description of the value
30 * @param deprecatedVersion
31 * the version this value was deprecated in
32 * @return the new allowed value
33 */
34 @SuppressWarnings("PMD.ShortMethodName")
35 @NonNull
36 static IAllowedValue of(
37 @NonNull String value,
38 @NonNull MarkupLine description,
39 @Nullable String deprecatedVersion) {
40 return new DefaultAllowedValue(value, description, deprecatedVersion);
41 }
42
43 /**
44 * Retrieves the enumerated value associated with this allowed value constraint
45 * entry.
46 *
47 * @return the value
48 */
49 @NonNull
50 String getValue();
51
52 /**
53 * If the value is deprecated, get the deprecated version.
54 *
55 * @return the deprecated version or {@code null} if the value is not deprecated
56 */
57 String getDeprecatedVersion();
58
59 /**
60 * Retrieves the enumerated value's description associated with this allowed
61 * value constraint entry.
62 *
63 * @return the description
64 */
65 @NonNull
66 MarkupLine getDescription();
67 }