Skip to content

Commit 01eed4a

Browse files
committed
[enhancement] deprecate Cardinality _MANY
in preparation of replaceing _MANY with ONE_OR_MORE this enum is marked for depecation Signed-off-by: Patrick Reinhart <patrick@reini.net>
1 parent 3b13232 commit 01eed4a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

exist-core/src/main/java/org/exist/xquery/Cardinality.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ public enum Cardinality {
4747
//TODO(AR) can we eliminate this?
4848
EXACTLY_ONE(ONE),
4949

50-
//TODO(AR) eliminate this in favour of probably ONE_OR_MORE
50+
/**
51+
* @deprecated will be replaced with #ONE_OR_MORE
52+
*/
53+
@Deprecated(forRemoval = true, since = "6.0.0")
5154
_MANY(MANY),
5255

5356
/**
@@ -140,14 +143,12 @@ public static Cardinality superCardinalityOf(final Cardinality a, final Cardinal
140143
* @return the XQuery notation
141144
*/
142145
public String toXQueryCardinalityString() {
143-
// impossible
144146
return switch (this) {
145147
case EMPTY_SEQUENCE -> "empty-sequence()";
146148
case EXACTLY_ONE -> "";
147149
case ZERO_OR_ONE -> "?";
148150
case _MANY, ONE_OR_MORE -> "+";
149151
case ZERO_OR_MORE -> "*";
150-
default -> throw new IllegalArgumentException("Unknown cardinality: " + name());
151152
};
152153
}
153154

@@ -157,14 +158,12 @@ public String toXQueryCardinalityString() {
157158
* @return a pronounceable description
158159
*/
159160
public String getHumanDescription() {
160-
// impossible
161161
return switch (this) {
162162
case EMPTY_SEQUENCE -> "empty";
163163
case EXACTLY_ONE -> "exactly one";
164164
case ZERO_OR_ONE -> "zero or one";
165165
case _MANY, ONE_OR_MORE -> "one or more";
166166
case ZERO_OR_MORE -> "zero or more";
167-
default -> throw new IllegalArgumentException("Unknown cardinality: " + name());
168167
};
169168
}
170169

0 commit comments

Comments
 (0)