public enum RestAPIVersion extends Enum<RestAPIVersion>
REST API versions are global and thus apply to every REST component.
Changes that must result in an API version increment include but are not limited to: - modification of a handler url - addition of new mandatory parameters - removal of a handler/request - modifications to request/response bodies (excluding additions)
Modifier and Type | Class and Description |
---|---|
static class |
RestAPIVersion.RestAPIVersionComparator
Comparator for
RestAPIVersion that sorts versions based on their version number, i.e. |
Modifier and Type | Method and Description |
---|---|
static RestAPIVersion |
fromURLVersionPrefix(String prefix)
Converts the given URL version prefix (e.g "v1") to a
RestAPIVersion . |
static RestAPIVersion |
getLatestVersion(Collection<RestAPIVersion> versions)
Returns the latest version from the given collection.
|
String |
getURLVersionPrefix()
Returns the URL version prefix (e.g.
|
boolean |
isDefaultVersion()
Returns whether this version is the default REST API version.
|
boolean |
isStableVersion()
Returns whether this version is considered stable.
|
static RestAPIVersion |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static RestAPIVersion[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final RestAPIVersion V0
public static final RestAPIVersion V1
public static RestAPIVersion[] values()
for (RestAPIVersion c : RestAPIVersion.values()) System.out.println(c);
public static RestAPIVersion valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String getURLVersionPrefix()
public boolean isDefaultVersion()
public boolean isStableVersion()
public static RestAPIVersion fromURLVersionPrefix(String prefix)
RestAPIVersion
.prefix
- prefix to convertedIllegalArgumentException
- if the prefix doesn't match any versionpublic static RestAPIVersion getLatestVersion(Collection<RestAPIVersion> versions)
versions
- possible candidatesCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.