public final class Revision extends Object implements Comparable<Revision>, Serializable
APIs which involve this class should always transfer instances via Optional<Revision>, which is
the primary bridge data type. Implementations can use nullable fields with explicit conversions to/from
Optional. Both patterns can take advantage of compare(Optional, Optional) and
compare(Revision, Revision) respectively.
| Modifier and Type | Field and Description |
|---|---|
static Revision |
MAX_VALUE
Revision which compares as greater than any other valid revision.
|
static Pattern |
STRING_FORMAT_PATTERN
String format pattern, which can be used to match parts of a string into components.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
compare(@NonNull Optional<Revision> first,
@NonNull Optional<Revision> second)
Compare two
Optionals wrapping Revisions. |
static int |
compare(@Nullable Revision first,
@Nullable Revision second)
Compare two explicitly nullable Revisions.
|
int |
compareTo(Revision o) |
boolean |
equals(Object obj) |
int |
hashCode() |
static @NonNull Revision |
of(@NonNull String str)
Parse a revision string.
|
static @NonNull Optional<Revision> |
ofNullable(@Nullable String str)
Parse a (potentially null) revision string.
|
String |
toString() |
public static final Pattern STRING_FORMAT_PATTERN
public static final Revision MAX_VALUE
public static @NonNull Revision of(@NonNull String str)
str - String to be parsedDateTimeParseException - if the string format does not conform specification.NullPointerException - if the string is nullpublic static @NonNull Optional<Revision> ofNullable(@Nullable String str)
Optional.empty().str - String to be parsedDateTimeParseException - if the string format does not conform specification.public static int compare(@NonNull Optional<Revision> first, @NonNull Optional<Revision> second)
Optionals wrapping Revisions. Arguments and return value are consistent with
Comparator.compare(Object, Object) interface contract. Missing revisions compare as lower
than any other revision.first - First optional revisionsecond - Second optional revisionpublic static int compare(@Nullable Revision first, @Nullable Revision second)
compareTo(Revision), this handles both arguments
being null such that total ordering is defined.first - First revisionsecond - Second revisionpublic int compareTo(Revision o)
compareTo in interface Comparable<Revision>Copyright © 2019 OpenDaylight. All rights reserved.