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